Skip to content

Recommended way of using Mobx with React in 2022? #3253

Answered by urugator
benjick asked this question in Q&A
Discussion options

You must be logged in to vote

You have to wrap your state in observable and your components in observer. In exchange, you don't have to worry about immutability, memoization, selectors, reducers, subscriptions.

Provider

It's up to you how you get state into your component - react context/import/local state.

Is that possible?

No, because we have to wrap over rendering logic. Also it's no more tedious than using React.memo, which you would have to use anyway to achieve similar perf benefits.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@benjick
Comment options

@BrianHung
Comment options

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