I am new to React Native, I am trying to change the state of an arithmetic function in a class component located in one screen and then share it globally in order to use it in different screens and possibly change it, what are some of the ways in which I can do this?
Asked
Active
Viewed 42 times
0
-
Maybe react-redux can help ypu ? – Kishieel Mar 17 '21 at 15:08
-
You can use [context](https://reactjs.org/docs/context.html) API or other state management library like [Redux](https://redux.js.org/introduction/getting-started) – imKrishh Mar 17 '21 at 15:21
1 Answers
0
You can either lift the state up or use context API
also maybe you should consider using React Hooks
maybe this thread is similar to your issue

Mohammed
- 133
- 9
-
I am using React Navigation to navigate through my bottom tab navigator, is it possible to use context API with it? – Mar 17 '21 at 17:23
-
the context API has nothing to do with react-navigation it is a React API so it should work with react and react-native. you can check these: 1- [How to Use the React Context API to Build React Native, Expo, and Firebase Apps](https://levelup.gitconnected.com/how-to-use-the-react-context-api-to-build-react-native-expo-and-firebase-apps-adda840e52b0) 2- https://stackoverflow.com/questions/51187582/how-should-the-new-context-api-work-with-react-native-navigator – Mohammed Mar 17 '21 at 20:41