CharlesStover/reactn

react native compatible?

ddikodroid opened this issue · 5 comments

can i use this package in react native project?

Yes, you can. :)

Hello ! I do use ReactN with React Native and it works nicely. Except for the re-rendering after a this.setGlobal(). React Native and Expo now implement React Hook (https://blog.expo.io/expo-sdk-v33-0-0-is-now-available-52d1c99dfe4c#7cec).

Any idea why ReactN does not trigger components re-rendering ?

If you are not wrapping your app in the ReactNProvider, you may also try that.

Otherwise, I'm not sure why it would not work. ReactN supports React Native, but it's not a RN-first approach. If you have the option to use hooks, I'd suggest using them where possible.

I don't see any doc about ReactNProvider. Could you provide a little exemple to see how to import and use it ?

EDIT : Is that it ? https://github.com/CharlesStover/reactn/blob/master/Provider.md
I need only one global state.
EDIT 2 : No more luck with a root ReactNProvider.
EDIT 3 : I'm using React components a lot. While React Hook prefers functions. :'/

Hi again @CharlesStover !
I create a small example to reproduce the issue. Would it help you to find a fix ?

Here it is : https://github.com/JegoYann/repro-reactn-issue-global-refresh