1. Zustand (minimalistic)
npm install zustand
import create from "zustand";
const useStore = create((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
}));
function Counter() {
  const { count, increment } = useStore();
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={increment}>+1</button>
    </div>
  );
}
✅ No provider needed, works out of the box.
2. Recoil (by Facebook)
npm install recoil
import { atom, useRecoilState, RecoilRoot } from "recoil";
const countState = atom({
  key: "countState",
  default: 0,
});
function Counter() {
  const [count, setCount] = useRecoilState(countState);
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  );
}
function App() {
  return (
    <RecoilRoot>
      <Counter />
    </RecoilRoot>
  );
}
✅ Uses atoms (pieces of state) and selectors.
3. Jotai (atomic state)
npm install jotai
import { atom, useAtom } from "jotai";
const countAtom = atom(0);
function Counter() {
  const [count, setCount] = useAtom(countAtom);
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  );
}
✅ Extremely lightweight, state is just atoms.