Back to course

The useState Hook: Introduction to State

React JS 0 to Hero: The Complete Guide

State with useState

State allows components to remember information and re-render when it changes.

jsx import { useState } from 'react';

function Counter() { const [count, setCount] = useState(0); return ( <button onClick={() => setCount(count + 1)}> Count: {count} ); }