Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
actions.set(`Logging in ${payload.username}`);
}),
);
}),
},
todos: {
items: [],
firstItem: select(state =>
state.items.length > 0 ? state.items[0] : undefined,
),
addTodo: action((state, payload) => {
state.items.push(payload);
}),
},
user: userModel,
counter: reducer((state = 0, action) => {
switch (action.type) {
case 'COUNTER_INCREMENT':
return state + 1;
default:
return state;
}
}),
});
/**
* You can use the "standard" store APIs
*/
console.log(store.getState().todos.firstItem);
store.dispatch({ type: 'COUNTER_INCREMENT' });
export const createModel = (history: History): RootModel => {
const rootModel: RootModel = {
router: reducer(connectRouter(history) as any),
app: appModel,
network: networkModel,
bitcoind: bitcoindModel,
lightning: lightningModel,
designer: designerModel,
modals: modalsModel,
};
return rootModel;
};