Refactor default state out of reducer
[MAILPOET-2450]
This commit is contained in:
committed by
Jack Kitterhing
parent
a94cf7e162
commit
63cde2e630
@ -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: {},
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user