React 18 use mobx without observer #3589
ikabetskyi-trimac
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
If this works with no caveats, it seems it would be useful to document and export a helper such as export const useSelector = <T>(selector: () => T): T => {
return useSyncExternalStore(autorun, selector);
} (related) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Please check the discussion under |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In React 18 we have useSyncExternalStore hook and we can work with our global store without observer.
const selector = () => mobxStore.data;
const data= useSyncExternalStore(autorun, selector);
Beta Was this translation helpful? Give feedback.
All reactions