本文整理汇总了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;