May 19 2026
Hooks are a special function in React, introduced in version 16.8, that allow you to "hook into" state and lifecycle features from functional components without writing a class.
Core Built-in Hooks
React provides several built-in Hooks to handle common tasks:
- useState
- useEffect
- useContext
- useReducer
- useMomo & useCallback
- useRef
- use
useState
useState adds local state to a functional component, allowing it to "remember" information like user input or counter values.
**Toggle Button**
function set(){
const [isOn, setIsOn] = useState(false);
return(
<div>
<button onClick={() => setIsOn(!isOn)}>
{isOn? "ON ": "OFF"}
</button>
</div>
}


Top comments (0)