Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Parish stephenparish

View GitHub Profile
@stephenparish
stephenparish / mini-redux.js
Last active Dec 12, 2019 — forked from MarcoWorms/mini-redux.js
Redux in a nutshell
View mini-redux.js
function createStore (reducers) {
let state = reducers()
const subscribers = [];
const store = {
dispatch: (action) => {
state = reducers(state, action);
subscribers.forEach((subscriber) => subscriber());
},
getState: () => {
return state
You can’t perform that action at this time.