Home > front end >  How to make a function in one screen affect an item in another in react native
How to make a function in one screen affect an item in another in react native

Time:10-04

I'm new to coding so I really don't know how to phrase my question but let me try. So in the Signup page of my react native up, there is a section you need to input your name. This name is supposed to be displayed on the Home page immediately you create an account. I've used onChangeText on the text input like this <TextInput onChangeText={(val) => setName(val)}/> so I want to use setName on the Home screen so that it can immediately pick whatever the user enters during sign up. Hope you guys understand what I'm saying

CodePudding user response:

Custom hooks come into play here, and check out official docs https://reactjs.org/docs/hooks-overview.html

CodePudding user response:

you can also use redux or useContext hook

  • Related