Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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(
,
document.getElementById('root'),
);
import createConnectedRouter from 'found/lib/createConnectedRouter';
import getStoreRenderArgs from 'found/lib/getStoreRenderArgs';
import resolver from 'found/lib/resolver';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from './configureStore';
import render from './render';
const store = configureStore(
new BrowserProtocol(),
window.__PRELOADED_STATE__, // eslint-disable-line no-underscore-dangle
);
const matchContext = { store };
const ConnectedRouter = createConnectedRouter({ render });
(async () => {
const initialRenderArgs = await getStoreRenderArgs({
store,
matchContext,
resolver,
});
ReactDOM.hydrate(
,
export function createRouterElement(renderArgs, { dispatch, getState }) {
const ConnectedRouter = createConnectedRouter({
render: (renderArgs) => {
// Force re-mount the last route component on location path change.
// https://github.com/4Catalyzer/found/issues/199#issuecomment-415616836
const elements = renderArgs.elements
if (elements && window.reactPagesRemountOnNavigate !== false) {
elements[elements.length - 1] = React.cloneElement(elements[elements.length - 1], { key: renderArgs.location.pathname })
}
return (
{render(renderArgs)}
)
}
})
return (
export function createClientRouter() {
return createConnectedRouter({ render })
}