React State Management Without Redux Quiz
Four checks on the non-Redux options for sharing React state: local component state, Context, useReducer, and lightweight stores like Zustand or Jotai.
Question Bank
Easy
JavaScript
4 questions
quiz
react
hooks
state-machine
588 views
11
Most React apps do not need Redux. What is the right default flow for picking where state should live? Sketch the lift-up step in code.
Build a ThemeContext with a provider and a useTheme hook. The hook should return { theme, toggle } and throw if called outside the provider.
Migrate this useState cart to useReducer. Why does the reducer version scale better as the cart grows more actions?
import { useState } from 'react';
function Cart() {
const [items, setItems] = useState([]);
const add = (p) => setItems((xs) => [...xs, p]);
const remove = (id) => setItems((xs) => xs.filter((x) => x.id !== id));
const clear = () => setItems([]);
return <CartView items={items} add={add} remove={remove} clear={clear} />;
}When does a lightweight store like Zustand or Jotai earn its keep over plain Context + useReducer? Be concrete about the failure mode it fixes.
