React Hooks Guide

Basic Hooks

useState

Manage local state in functional components. Perfect for simple state management needs.

useEffect

Handle side effects in your components, like data fetching, subscriptions, or DOM mutations.

useContext

Access our theme context for dark/light mode switching. Try the button above!

Additional Hooks

useActionState

Track the state of async actions and transitions in React applications.

useReducer

Manage complex state logic using a reducer pattern, similar to Redux.

useCallback

Memoize functions to prevent unnecessary re-renders in child components.

useMemo

Memoize expensive computations to optimize performance.

useRef

Access DOM elements directly and persist values across renders without causing re-renders.

useLayoutEffect

Similar to useEffect, but fires synchronously after DOM mutations.

useImperativeHandle

Customize the instance value exposed to parent components when using refs.

Performance Hooks

useTransition

Mark state updates as non-urgent to keep the UI responsive during heavy updates.

useDeferredValue

Defer updating less important parts of the UI to avoid blocking more critical updates.