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 { registerStore } from '@wordpress/data';
|
||||||
import actions from './actions.jsx';
|
import actions from './actions.jsx';
|
||||||
import reducer from './reducer.jsx';
|
import createReducer from './reducer.jsx';
|
||||||
import selectors from './selectors.jsx';
|
import selectors from './selectors.jsx';
|
||||||
|
|
||||||
|
const defaultState = {
|
||||||
|
sidebarOpened: true,
|
||||||
|
};
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
reducer,
|
reducer: createReducer(defaultState),
|
||||||
actions,
|
actions,
|
||||||
selectors,
|
selectors,
|
||||||
controls: {},
|
controls: {},
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
const DEFAULT_STATE = {
|
export default (defaultState) => (state = defaultState, action) => {
|
||||||
sidebarOpened: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default (state = DEFAULT_STATE, action) => {
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'TOGGLE_SIDEBAR':
|
case 'TOGGLE_SIDEBAR':
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user