[All situations](/)

4

# React Context keeps growing. Redux is on the table.

Context passes values down. It doesn't manage them.

`<CartProvider>``<UserProvider>`

Today · providers

```
export function App() {
  return (
    <CartProvider>
      <UserProvider>
        <FiltersProvider>
          <main>App</main>
        </FiltersProvider>
      </UserProvider>
    </CartProvider>
  )
}
```

With a store · no provider

```
export const $cart = atom<Product[]>([])
export const addItem = (item: Product) => $cart.set([...$cart.get(), item])
export function CartCount() {
  const cart = useStore($cart)
  return <span>{cart.length}</span>
}
```

Theme, locale**Keep Context**

Time travel, strict patterns**Redux Toolkit**

Shared state, less wiring**A small store**

Rarely-changing values? Context is still the right tool.

`npm install nanostores`

[Getting started →](/docs/getting-started/)

[No app logic in React hooks →](/for/logic-outside-hooks/)[Two islands need the same data →](/for/islands/)
