Skip to content

Best practices for creating globally accessible shared values? #4529

Answered by tomekzaw
jerryjfwang asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @jerryjfwang

Is the best practice to use React Context?

Yep, this should work.

Is it possible to create shared values outside of React (eg: createSharedValue vs useSharedValue)?

Nope, this is not officially supported. Technically, you could use makeMutable but it's not a part of public API so we give no guarantees and things may break.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@XantreDev
Comment options

@ryskin
Comment options

@MatiPl01
Comment options

Answer selected by jerryjfwang
Comment options

You must be logged in to vote
1 reply
@zgordon02
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants