Do child components need @observer when parent is already an Observer and Mobx state is not passed from Parent rather it is directly imported into child components? #3914
Unanswered
AishwaryaChat
asked this question in
Q&A
Replies: 1 comment 2 replies
-
https://mobx.js.org/react-integration.html#always-read-observables-inside-observer-components |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suppose I have an React App component which is the root component, and it is rendering many other Providers and child components. Only the App root component is decorated with observer, App component is not using the Mox state anywhere directly but the providers in it and children components are using it, by directly importing the Mobx state inside it, and these Providres and child components are not decorated with observer.
Question:
Here is the reference code for this
RootStore.js
Provider1.js
RouteComponent.jsx
App.jsx
Beta Was this translation helpful? Give feedback.
All reactions