react-tips

Installation
SKILL.md

10 React Tips That Actually Matter

Use these patterns when writing or reviewing React code. Each one prevents real bugs or eliminates unnecessary complexity.

1. Use useReducer When State Is Related

When multiple useState values depend on each other (loading + error + data), use useReducer instead. Prevents impossible state combinations where your UI lies to the user.

// BAD: Three setters you can forget to coordinate
setIsLoading(false);
setError(null);
setPost(data);

// GOOD: One dispatch, one guaranteed valid state
dispatch({ type: 'FETCH_SUCCESS', payload: data });

When to apply: Any time changing one piece of state requires changing another.

Installs
34
GitHub Stars
29
First Seen
Apr 3, 2026
react-tips — cst2989/react-tips-skill