React Native
About Lesson

In this React Native lesson we are going to learn about React Native State, we have already learned that how you can use props, now state is like a component’s personal data storage. State is useful for handling data that changes over time or that comes from user interaction, you can create state within the component and that component owns the state, before this it was not possible to use state inside functional component, but now by using React Hooks we can use state inside a functional component.

 

 

This is my new Name.js component, in this component i have created a state at the top, after that i have created a button, i want when i click on the button, the state should be changed, so for that we can use setState({}).

 

 

 

This is my App.js file.

 

 

First run this command.

 

 

 

And after that run your application, click on the button you will see that the text is changed.

React Native State
React Native State

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found