State and the useState Hook
Learn State and the useState Hook (Fundamentals of React, ReactJS) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is State? • State is data that belongs to a component and can change over time — unlike props, state is owned and managed BY the component itself, not passed in from outside. • When state changes, React automatically re-renders the component to reflect the new value on screen. • The useState Hook is how a functional component declares state.
More lessons in Fundamentals of React
- Introduction to ReactJS
- Single Page Application (SPA)
- Installing Node.js & npm
- JSX Syntax and Rules
- Components (Functional vs Class)
- Props in React
- Event Handling in React
- Conditional Rendering
- Lists and Keys
- Forms and Controlled Components
- useEffect Hook and Side Effects
- Context API
- React Router (Basic Routing)
- Component Lifecycle