🖨 Print / Save PDF
← Lesson
BitWith
Bite
React · Quick Reference
Lesson 8 — useContext
Cheat Sheet
React
In one line:
Context lets deeply nested components read shared data directly, skipping prop drilling entirely.
3-Step Setup
1
createContext(defaultValue)
2
<Context.Provider value={...}>
3
useContext(Context)
Custom Hook Wrapper
const AuthContext = createContext(null); export const useAuth = () => useContext(AuthContext); // Anywhere: const { user, logout } = useAuth();