We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const createStore = (reducer) > { let state; let listeners = []; const getState = () => state; const dispatch = (action) => { state = reduce(state, action); listeners.forEach(listener => listener()); } const subscribe = (listener) => { listeners.push(listener); return () => { listeners = listeners.filter(l => l !== listener) }; } dispatch( {} ) return { getState, dispatch, subscribe}; }
// 接受多个reducer // 对state做遍历执行 找到对应的reducer然后进行处理。 const combineReducers = (reducers) => { return (state = {} ,action )=>{ return Object.keys(reducers).reduce( (nextState,key) => { nextState[key] = reducers[key](state[key],action); return nextState }, {} ) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: