Toggle language
← Back to Cheat Sheets
React Cheat Sheet
Essential React syntax and patterns for quick reference
useState Hook
Hooksconst [state, setState] = useState(initialValue)
useEffect Hook
HooksuseEffect(() => { ... }, [dependencies])
useContext Hook
Hooksconst value = useContext(MyContext)
useReducer Hook
Hooksconst [state, dispatch] = useReducer(reducer, init)
Conditional Rendering
Rendering{condition && <Component />}
List Rendering
Rendering{items.map(item => <Item key={item.id} {...item} />)}