p
Size: a a a
p
В
В
F
p
F
В
F
const createStore = (rootReducer, initialState) => {
let state = rootReducer(initialState);
const subsribers = [];
const getSate = () => state
const subscribe = cb => subsribers.push(cb);
const dispatch = action => {
state = rootReducer(state, action);
subsribers.forEach(s => s());
}
return {
dispatch,
getSate,
subscribe
}
}
p
F
В
p
F
В
p
p
F
p
В