Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
to: '/foo',
}),
],
},
];
const store = createStore(
combineReducers({
found: foundReducer,
}),
compose(
createHistoryEnhancer({
protocol: new BrowserProtocol(),
middlewares: [queryMiddleware],
}),
createMatchEnhancer(new Matcher(routeConfig)),
),
);
store.dispatch(FarceActions.init());
const ConnectedRouter = createConnectedRouter({
render: createRender({
/* eslint-disable react/prop-types */
renderError: ({ error }) => (
<div>{error.status === 404 ? 'Not found' : 'Error'}</div>
),
/* eslint-enable react/prop-types */
}),
});
ReactDOM.render(
export function createRouterStoreEnhancers(routes, createHistoryProtocol, options = {}) {
const middlewares = [
queryMiddleware
]
if (options.basename) {
middlewares.push(createBasenameMiddleware({
basename: options.basename
}))
}
return [
createHistoryEnhancer({
protocol: createHistoryProtocol(),
middlewares
}),
createMatchEnhancer(
// new Matcher(hotRouteConfig(routes))
new Matcher(routes)
)
]
}
function generateStore(protocol) {
const historyEnhancer = createHistoryEnhancer({
protocol,
middlewares: [queryMiddleware],
})
const matcherEnhancer = createMatchEnhancer(
new Matcher(routeConfig),
)
const middleWare = composeEnhancers(
historyEnhancer,
matcherEnhancer,
)
const store = createStore(reducers, middleWare)
store.dispatch(FarceActions.init())
return store
}
export default function configureStore(historyProtocol, preloadedState) {
return createStore(
combineReducers({
found: foundReducer,
}),
preloadedState,
compose(
createHistoryEnhancer({
protocol: historyProtocol,
middlewares: [queryMiddleware],
}),
createMatchEnhancer(new Matcher(routeConfig)),
),
);
}