useState is a React Hook that is used in React Native it allows to add a state in functional components(accepts props as an argument and return JSX to render UI).
useState returns an array with two values,
Current State
Function to update the state
we can set a initial value in useState to startwith
const [count,setCount] = useState(1);
here 1 is the initial value count is the current State and setCount is the function to update that current state
Top comments (0)