Skip to content

Instantly share code, notes, and snippets.

@nickmeldrum
Created January 10, 2020 10:37
Show Gist options
  • Save nickmeldrum/a6da8ea7d467f039ef3a92d9920174ff to your computer and use it in GitHub Desktop.
Save nickmeldrum/a6da8ea7d467f039ef3a92d9920174ff to your computer and use it in GitHub Desktop.
computed property always empty string
export interface Model {
router?: Reducer<any>;
routing: {
push: Thunk<Model, string>;
currentBoard: Computed<any>;
};
data: Data;
ui: Ui;
};
const {
createReduxHistory,
routerMiddleware,
routerReducer,
} = createReduxHistoryContext({
history: createBrowserHistory(),
reduxTravelling: true,
});
const model: Model = {
router: reducer(routerReducer),
routing: {
push: thunk((actions, payload, { dispatch }) => dispatch(push(payload))),
currentBoard: computed(state => {
return state.router ? state.router.location.pathname : '';
}),
},
data,
ui,
};
export default createStore(model, {middleware: [routerMiddleware]});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment