本文整理匯總了TypeScript中redux-devTools.persistState函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript persistState函數的具體用法?TypeScript persistState怎麽用?TypeScript persistState使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了persistState函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getStore
export default function getStore(initialState?:any){
const enhancer = compose
( applyMiddleware
( reduxImmutableStateInvariant()
, thunk
)
//, getDevTools()
, DevTools.instrument()
, persistState(getDebugSessionKey()
)
);
const store = createStore
( rootReducer
, initialState
, enhancer
);
if(module.hot){
module.hot.accept
( '../actions'
, () => store.replaceReducer(require('../actions').reducer)
);
}
return store;
}
示例2: routerMiddleware
import thunk from 'redux-thunk';
import DevTools from '../containers/devTools';
import { rootReducer } from '../reducers';
import { hashHistory } from 'react-router';
import { persistState } from 'redux-devtools';
import { routerMiddleware } from 'react-router-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import * as createLogger from 'redux-logger';
import { initialState } from './props';
const router = routerMiddleware(hashHistory);
// create logger
const logger = createLogger({
level: 'info',
collapsed: true,
});
const enhancer = compose(
applyMiddleware(thunk, router, logger),
DevTools.instrument(),
persistState(
window.location.href.match(
/[?&]debug_session=([^&]+)\b/
))
)
export const store = createStore(rootReducer, initialState, applyMiddleware(thunk));
示例3: enhance
import thunkMiddleware from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'
import {reducer,state} from '../apps/data'
import { enhance } from '../apps/Root/DevTools';
import {persistState} from 'redux-devtools';
const enhancer = compose
( applyMiddleware
( thunkMiddleware
//, createLogger()
)
, enhance()
, persistState(getDebugSessionKey())
);
export default function configureStore(initialState=state){
const store = createStore
( reducer
, state
, enhancer
);
if (module.hot) {
module.hot.accept('../apps/data', () => store.replaceReducer
( require('../apps/data').reducer
)
);
}
return store;
}
示例4: createLogger
import rootReducer from '../reducers';
import DevTools from '../containers/DevTools';
const logger = createLogger({
level: 'info',
collapsed: true,
});
const router = routerMiddleware(hashHistory);
const enhancer = compose(
applyMiddleware(thunk, router, logger),
DevTools.instrument(),
persistState(
new String(window.location.href.match(
/[?&]debug_session=([^&]+)\b/
)).toString()
)
);
export default function configureStore(initialState) {
const store = createStore(rootReducer, initialState, enhancer);
let extensionModule: NodeModule & {hot?} = module;
if (extensionModule.hot !== undefined) {
extensionModule.hot.accept('../reducers', () =>
store.replaceReducer(require('../reducers')) // eslint-disable-line global-require
);
}
return store;