Skip to content

Clarification regarding "React Optimization" section in docs #3989

Answered by tonyraoul
Omriruvio asked this question in Q&A
Discussion options

You must be logged in to vote

⚠️ Not a maintainer, I hope my answer is somehow useful.

Question 1:

I suppose the example is intentionally not wrapping MyComponent in observer to avoid dereferencing person.name (for example) and from triggering re-renders on MyComponent.

I the parent component MyComponent doesn't fire getName when it renders, thus it won't dehance person.name.

How would this look like if we were to access person or car from a store inside MyComponent instead of receiving it from props?

I believe it would have the same behaviour as the getX function, however you can't re-use the component and use a store.
Have a look on Dereference values late section.

Question 2:

Aren't we passing (unmemoized) new…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Omriruvio
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