How to use the found/lib/createMatchEnhancer function in found

To help you get started, we’ve selected a few found examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 4Catalyzer / found / examples / redux / src / index.js View on Github external
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(
github catamphetamine / react-pages / source / router / index.js View on Github external
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)
		)
	]
}
github jkettmann / universal-react-relay-starter-kit / client / store / index.js View on Github external
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
}
github 4Catalyzer / found / examples / universal-redux / src / configureStore.js View on Github external
export default function configureStore(historyProtocol, preloadedState) {
  return createStore(
    combineReducers({
      found: foundReducer,
    }),
    preloadedState,
    compose(
      createHistoryEnhancer({
        protocol: historyProtocol,
        middlewares: [queryMiddleware],
      }),
      createMatchEnhancer(new Matcher(routeConfig)),
    ),
  );
}