React Native
About Lesson

In this React Native lesson we are going to learn about React Native useState Hooks, so as i have already said that you can use stats inside a functional component using React Hooks, a Hook is a kind of function that lets you “hook into” React features. For example, useState is a Hook that lets you add state to function components.



So this is my component for creating react native useState hooks.




first of all you need to import useState hook form React.



And after that we are going to call useState, calling useState does two things:

  • it creates a “state variable” with an initial value—in this case the state variable is Name and its initial value is a simple string.
  • it creates a function to set that state variable’s value and that is setName




Now we can add our newly created component in the App.js.




First run this command.




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

React Native useState Hooks
React Native useState Hooks