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 { TodoAction } from '../actions/TodoActions';
|
||||
|
||||
export interface TodoState {
|
||||
todos: Todo[];
|
||||
}
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
const rootReducer: Reducer<
|
||||
TodoState,
|
||||
TodoAction,
|
||||
Partial<TodoState>
|
||||
> = combineReducers({
|
||||
todos,
|
||||
});
|
||||
}) as any;
|
||||
|
||||
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 rootReducer, { TodoState } from '../reducers';
|
||||
import DevTools from '../containers/DevTools';
|
||||
|
@ -8,13 +8,11 @@ function getDebugSessionKey() {
|
|||
return matches && matches.length > 0 ? matches[1] : null;
|
||||
}
|
||||
|
||||
const enhancer = compose(
|
||||
const enhancer: StoreEnhancer = compose(
|
||||
DevTools.instrument(),
|
||||
persistState(getDebugSessionKey()),
|
||||
);
|
||||
|
||||
export default function configureStore(
|
||||
initialState?: PreloadedState<TodoState>,
|
||||
) {
|
||||
export default function configureStore(initialState?: Partial<TodoState>) {
|
||||
return createStore(rootReducer, initialState, enhancer);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { createStore, PreloadedState } from 'redux';
|
||||
import { createStore } from 'redux';
|
||||
import rootReducer, { TodoState } from '../reducers';
|
||||
|
||||
export default function configureStore(
|
||||
initialState?: PreloadedState<TodoState>,
|
||||
) {
|
||||
export default function configureStore(initialState?: Partial<TodoState>) {
|
||||
return createStore(rootReducer, initialState);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PreloadedState, Store } from 'redux';
|
||||
import { Store } from 'redux';
|
||||
import { TodoState } from '../reducers';
|
||||
import { TodoAction } from '../actions/TodoActions';
|
||||
|
||||
const configureStore: (
|
||||
initialState?: PreloadedState<TodoState>,
|
||||
initialState?: Partial<TodoState>,
|
||||
) => Store<TodoState, TodoAction> =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? // eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
|
|
Loading…
Reference in New Issue
Block a user