Junior From PDF React React.js

What is state in React?

State is data that is local to a component and can change over time.

✅ Example using useState:

import { useState } from 'react';

function Counter() {

const [count, setCount] = useState(0);
return <button onClick={() => setCount(count +

1)}>{count}</button>;

}

More from React.js Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details