React Hooks Cheat Sheet/Reset component state

Reset state back to initial values.

Section: State Hooks

Reset component state

tsx
tsx
const initialForm = { email: '', password: '' };
const [form, setForm] = useState(initialForm);
const resetForm = () => setForm(initialForm);
Explanation

Useful for form reset behavior after submit or cancel.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing State Hooks
useState basic state
Create local component state.
OpenIn sheettsxsame section
useState updater function
Update based on previous state safely.
OpenIn sheettsxsame section
useState lazy initializer
Compute expensive initial state once.
OpenIn sheettsxsame section
useReducer basic reducer
Manage more structured state transitions.
OpenIn sheettsxsame section
useReducer with init function
Lazily derive reducer state.
OpenIn sheettsxsame section
useEffect after render
Run side effects after React commits updates.
OpenIn sheettsx2 tag match