You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--\src\store\reducers.js
`import { combineReducers } from 'redux'
import locationReducer from './location'
import navBarReducer from '../components/NavBar/modules/NavBar'
import loginReducer from '../components/Login/modules/Login'
代码结构是这样
--src\routes\Subscribe\index.js
const container = require('./containers/SubscribeContainer').default const reducer = require('./modules/Subscribe').default /* Add the reducer to the store on key 'counter' */ injectReducer(store, { key: 'subscribe', reducer })
--\src\routes\Subscribe\modules\Subscribe.js
[SUBSCRIBE_CHANGE_VIEW]: (state) => { console.info('-----------debug------------------') console.info(state) return { ...state, showStyle: state.showStyle === 'table' ? 'view' : 'table' } }
--\src\store\reducers.js
`import { combineReducers } from 'redux'
import locationReducer from './location'
import navBarReducer from '../components/NavBar/modules/NavBar'
import loginReducer from '../components/Login/modules/Login'
export const makeRootReducer = (asyncReducers) => {
return combineReducers({
navbar:navBarReducer,
location: locationReducer,
DATA:loginReducer,
...asyncReducers
})
}
export const injectReducer = (store, { key, reducer }) => {
store.asyncReducers[key] = reducer
store.replaceReducer(makeRootReducer(store.asyncReducers))
}
export default makeRootReducer`
--\src\components\Login\modules\Login.js
const ACTION_HANDLERS = { [LOGIN_FETCH_SUCCESS]: (state, action) => { return ({ ...action.payload }) } }
业务逻辑是这样,登录成功将获取的数据放入大的state(modules\Login.js),然后modules\Subscribe.js需要处理这个大的state.
modules里面怎么获取大的state啊,modules\Subscribe.js reducer 处理只能获取到当前的key('subscribe')下得state状态,怎么获取大的state 的属性值啊,我想获取DATA。
The text was updated successfully, but these errors were encountered: