Refactor default state out of reducer

[MAILPOET-2450]
This commit is contained in:
Rostislav Wolny
2019-10-24 14:12:58 +02:00
committed by Jack Kitterhing
parent a94cf7e162
commit 63cde2e630
2 changed files with 7 additions and 7 deletions

View File

@ -1,10 +1,14 @@
import { registerStore } from '@wordpress/data';
import actions from './actions.jsx';
import reducer from './reducer.jsx';
import createReducer from './reducer.jsx';
import selectors from './selectors.jsx';
const defaultState = {
sidebarOpened: true,
};
const config = {
reducer,
reducer: createReducer(defaultState),
actions,
selectors,
controls: {},

View File

@ -1,8 +1,4 @@
const DEFAULT_STATE = {
sidebarOpened: true,
};
export default (state = DEFAULT_STATE, action) => {
export default (defaultState) => (state = defaultState, action) => {
switch (action.type) {
case 'TOGGLE_SIDEBAR':
return {