ReactJS Hooks Reference Last Updated : 23 Jul, 2025 Suggest changes Share Like Article Like Report React hooks are functions that allow you to use state and other React features in functional components. Hooks were introduced in React 16.8, enabling developers to manage state and lifecycle features without needing class components. They simplify the development process and make it easier to write reusable and cleaner code.Below is the basic representation of the React JS Hooks useState. CSS /* Write CSS Here */ .App { display: flex; flex-direction: column; justify-content: center; align-items: center; } body { background-color: antiquewhite; } .App>h2 { text-align: center; } .App>button { width: 8rem; font-size: larger; padding: 2vmax auto; height: 1.8rem; color: white; background-color: rgb(34, 34, 33); border-radius: 10px; } button:hover { background-color: rgb(80, 80, 78); } JavaScript import React, { useState } from 'react'; import './App.css' const App = () => { const [num, setNum] = useState(0); const handleClick = () => { setNum(num + 1); }; return ( <div className="App"> <h2> {num}</h2> <button onClick={handleClick}> Add one </button> </div> ); }; export default App; The useState hook is used to create a num state, initialized to 0, and a setNum function to update it when the button is clicked.The handleClick function increments num by 1 each time the button is clicked, updating the displayed value in the <h2> tag.OutputWhy Use React Hooks?Simplifies Code: Hooks provide a simpler and cleaner way to write components by using functions instead of classes.State and Side Effects: Hooks allow you to use state (useState) and side effects (useEffect) in functional components.Reusability: Hooks make it easier to share logic across components by creating custom hooks.Readability: Functional components with hooks tend to be more concise and easier to read than class components.Different Hooks in ReactuseState: useState is used to add state to functional components.useEffect: useEffect is used to perform side effects (like fetching data or subscribing to services) in functional components.useContext: useContext allows you to access the value of a context in functional components.useReducer: useReducer is an alternative to useState for more complex state logic.useRef: useRef returns a mutable ref object which can be used to reference DOM elements or store mutable values.useMemo: useMemo is used to memoize values or computations to prevent expensive calculations on every render.useCallback: useCallback is used to memoize functions so that they are not recreated on every render.useLayoutEffect: Similar to useEffect, but it runs synchronously after all DOM mutations, allowing you to perform operations on the layout.useImperativeHandle: useImperativeHandle customizes the instance value that is exposed when using ref in functional components.Advantages of Using HooksCleaner Code: Hooks make code simpler and easier to read by allowing state and effects to be used directly in functional components.Better Reusability: Custom hooks allow the reuse of logic across different components.No this keyword: Hooks eliminate the need for the this keyword found in class components, reducing complexity and mistakes.More Functionality in Functional Components: Previously, only class components could use lifecycle methods and state. Now, with hooks, even functional components can manage state, side effects, and other features.React JS Hooks ReferenceuseState HookuseEffect HookuseRef HookuseMemo HookuseContext HookuseReducer HookuseHistory HookuseNavigate HookuseParams HookuseLayoutEffect HookuseImperativeHandle HookuseDebugValue HookuseUndoState HookuseSelect HookuseCallback HookuseTransition HookuseId HookuseInsertionEffect HookReactJS Custom HooksuseLocalStorage Custom HookuseForm Custom HookuseTimeout Custom HookuseOrientation Custom HookuseInterval Custom Hook K kartik Follow Article Tags : Web Technologies ReactJS React-Hooks Explore React Tutorial 5 min read React FundamentalsReact Introduction 6 min read React Environment Setup 3 min read React JS ReactDOM 2 min read React JSX 5 min read ReactJS Rendering Elements 3 min read React Lists 4 min read React Forms 4 min read ReactJS Keys 4 min read Components in ReactReact Components 4 min read ReactJS Functional Components 4 min read React Class Components 3 min read ReactJS Pure Components 4 min read ReactJS Container and Presentational Pattern in Components 2 min read ReactJS PropTypes 5 min read React Lifecycle 7 min read React HooksReact Hooks 8 min read React useState Hook 5 min read ReactJS useEffect Hook 5 min read Routing in ReactReact Router 5 min read React JS Types of Routers 10 min read Advanced React ConceptsLazy Loading in React and How to Implement it ? 4 min read ReactJS Higher-Order Components 5 min read Code Splitting in React 4 min read React ProjectsCreate ToDo App using ReactJS 3 min read Create a Quiz App using ReactJS 4 min read Create a Coin Flipping App using ReactJS 3 min read How to create a Color-Box App using ReactJS? 4 min read Dice Rolling App using ReactJS 4 min read Guess the number with React 3 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like