How to use the react-router-dom.matchPath function in react-router-dom

To help you get started, we’ve selected a few react-router-dom 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 readium / readium-desktop / src / renderer / components / searchResult / TextSearchResult.tsx View on Github external
public componentDidUpdate(prevProps: IProps) {
        const text = matchPath(
            this.props.location.pathname, routes["/library/search/text"],
        ).params.value;
        const prevText = matchPath(
            prevProps.location.pathname, routes["/library/search/text"],
        ).params.value;

        if (text !== prevText) {
            // Refresh searched pubs
            this.searchPublications();
        }
    }
github gzoreslav / react-redux-saga-universal-application / src / helper.js View on Github external
config.appData.routes.some(route => {
            const match = matchPath(req.url, route);
            if (match) {
                selectedRoutes.push(route);
            }
            return match;
        });
github liyanyan1994 / react-antd-admin-simplateTemplate / src / components / sidebar / index.jsx View on Github external
const isActive = (path, history) => {
    return matchPath(path, {
      path: history.location.pathname,
      exact: true,
      strict: false
    })
  }
github axetroy / blog / src / component / header / index.js View on Github external
className={(() => {
                  const navPath = nav.path;
                  const isMatchRoute = matchPath(pathname, {
                    path: navPath,
                  });
                  if (pathname === '/') {
                    return pathname === navPath ? navClassName : '';
                  } else {
                    return isMatchRoute && navPath !== '/' ? navClassName : '';
                  }
                })()}
              >
github linode / manager / src / features / Account / AccountLanding.tsx View on Github external
const matches = (p: string) => {
      return Boolean(matchPath(p, { path: this.props.location.pathname }));
    };
github maisano / react-router-transition / src / AnimatedRoute.js View on Github external
function getKey({ pathname }, path, exact) {
  return matchPath(pathname, { exact, path }) ? 'match' : 'no-match';
}
github brave / ethereum-remote-client / ui / app / pages / routes / index.js View on Github external
hideAppHeader () {
    const { location } = this.props

    const isInitializing = Boolean(matchPath(location.pathname, {
      path: INITIALIZE_ROUTE, exact: false,
    }))

    if (isInitializing && !this.onInitializationUnlockPage()) {
      return true
    }

    if (window.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
      return true
    }

    if (window.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_POPUP) {
      return this.onConfirmPage() || this.hasProviderRequests()
    }
  }
github lauterry / perfect-react-app / src / server / server.js View on Github external
routes.some(route => {
		const match = matchPath(req.path, route);
		if (match) promises.push(store.dispatch(route.loadData()));
		return match;
	});
github cerner / terra-dev-site / src / app / components / RawRoute.jsx View on Github external
  const route = routes.find(routeToMatch => matchPath(nonRawPath, routeToMatch));