fw-01 step 01 — The store, naive on purpose

Goal

Get stages 1–3 of src/spec.mjs green with the simplest implementation that could work. Do not add guards yet — you need to feel the bugs.

Tasks

  1. createStore(reducer, preloadedState?, enhancer?)getState, dispatch, subscribe.
  2. combineReducers, preserving the state reference when nothing changed. That reference stability is what makes downstream reference-equality checks work.
  3. applyMiddleware, composing left to right; write a logger and a thunk-shaped middleware.
  4. Run node spec.mjs. Stages 1–3 should pass; stage 4 should fail. That failure is the module.

Done when

  • Stages 1–3 green
  • Stage 4 failing, and you can predict which tests before running
  • You can explain why combineReducers must return the same object when nothing changed