← Redux track

Example 1 — Counter

One slice, one store: global state lives in the store; components subscribe with selectors and send events via dispatch. No async yet.

0

UI reads state.counter.value; buttons dispatch slice actions. RTK uses Immer so reducers can look mutable.

Files to read

Open these in the repo — each example is isolated in its own folder.

  • src/app/learn/redux/example-1-counter/NOTES.md
  • src/app/learn/redux/example-1-counter/_features/counterSlice.ts
  • src/app/learn/redux/example-1-counter/_store/store.ts
  • src/app/learn/redux/example-1-counter/_components/CounterDemo.tsx