@sialvsic/redux
v0.1.2
Published
This repo aim to analyze Redux and DIY it.
Downloads
6
Readme
redux-analyze
This repo aim to analyze Redux and DIY it.
Redux 动机
- More State, More Complex
- How Manage State
- React didn’t handle it
Redux 三大原则
- Single source of truth - 单一数据源
- State is read only - State是只读的
- Changes are made with pure functions - 使用纯函数进行修改
Redux 核心组成
- Store
- Action
- Reducer
Redux WorkFlow
Action -> Reducers -> Store -> View
API store
- getState()
- subscribe(listener)
- dispatch(action)
Other
- createStore(reducer, [preloadedState], enhancer)
- combineReducers(reducers)
- bindActionCreators
- compose
- applyMiddleware
- middleware
Teach Path
- Store(createStore)
- combineReducers(reducers)
- bindActionCreators(actionCreators, dispatch)
- compose(...functions)
- applyMiddleware && createStore-enhancer
- logger
- thunk
Learn Path
Redux -> Redux thunk -> React Redux -> React -> React Router
How to publish to npm
npm publish --access publicnpm unpublish @sialvsic/[email protected] -fHow to publish in local with verdaccio
npm publish --registry http://localhost:4873