mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 08:30:02 +03:00
slider-monitor-example
This commit is contained in:
parent
5596651862
commit
14b25d7e9b
|
@ -1,12 +1,17 @@
|
||||||
import { combineReducers } from 'redux';
|
import { combineReducers, Reducer } from 'redux';
|
||||||
import todos, { Todo } from './todos';
|
import todos, { Todo } from './todos';
|
||||||
|
import { TodoAction } from '../actions/TodoActions';
|
||||||
|
|
||||||
export interface TodoState {
|
export interface TodoState {
|
||||||
todos: Todo[];
|
todos: Todo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootReducer = combineReducers({
|
const rootReducer: Reducer<
|
||||||
|
TodoState,
|
||||||
|
TodoAction,
|
||||||
|
Partial<TodoState>
|
||||||
|
> = combineReducers({
|
||||||
todos,
|
todos,
|
||||||
});
|
}) as any;
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createStore, compose, PreloadedState } from 'redux';
|
import { createStore, compose, StoreEnhancer } from 'redux';
|
||||||
import { persistState } from '@redux-devtools/core';
|
import { persistState } from '@redux-devtools/core';
|
||||||
import rootReducer, { TodoState } from '../reducers';
|
import rootReducer, { TodoState } from '../reducers';
|
||||||
import DevTools from '../containers/DevTools';
|
import DevTools from '../containers/DevTools';
|
||||||
|
@ -8,13 +8,11 @@ function getDebugSessionKey() {
|
||||||
return matches && matches.length > 0 ? matches[1] : null;
|
return matches && matches.length > 0 ? matches[1] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enhancer = compose(
|
const enhancer: StoreEnhancer = compose(
|
||||||
DevTools.instrument(),
|
DevTools.instrument(),
|
||||||
persistState(getDebugSessionKey()),
|
persistState(getDebugSessionKey()),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function configureStore(
|
export default function configureStore(initialState?: Partial<TodoState>) {
|
||||||
initialState?: PreloadedState<TodoState>,
|
|
||||||
) {
|
|
||||||
return createStore(rootReducer, initialState, enhancer);
|
return createStore(rootReducer, initialState, enhancer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { createStore, PreloadedState } from 'redux';
|
import { createStore } from 'redux';
|
||||||
import rootReducer, { TodoState } from '../reducers';
|
import rootReducer, { TodoState } from '../reducers';
|
||||||
|
|
||||||
export default function configureStore(
|
export default function configureStore(initialState?: Partial<TodoState>) {
|
||||||
initialState?: PreloadedState<TodoState>,
|
|
||||||
) {
|
|
||||||
return createStore(rootReducer, initialState);
|
return createStore(rootReducer, initialState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { PreloadedState, Store } from 'redux';
|
import { Store } from 'redux';
|
||||||
import { TodoState } from '../reducers';
|
import { TodoState } from '../reducers';
|
||||||
import { TodoAction } from '../actions/TodoActions';
|
import { TodoAction } from '../actions/TodoActions';
|
||||||
|
|
||||||
const configureStore: (
|
const configureStore: (
|
||||||
initialState?: PreloadedState<TodoState>,
|
initialState?: Partial<TodoState>,
|
||||||
) => Store<TodoState, TodoAction> =
|
) => Store<TodoState, TodoAction> =
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
? // eslint-disable-next-line @typescript-eslint/no-require-imports
|
? // eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
|
|
Loading…
Reference in New Issue
Block a user