Course · Section 10: A Closer Look at Functions · Lecture 144: Closures
Build a tiny store. Implement `createStore(reducer, initialState)` returning an object with: - `getState()` returns the current state. - `dispatch(action)` runs the reducer and notifies all subscribers. - `subscribe(listener)` registers a listener called on every dispatch.
+ 1 hidden test run on Submit.
A closure holds private state and listeners; dispatch threads the reducer and notifies subscribers, the core of Redux.
Run your code to see results.