How to use the react-static.getRoutePath function in react-static

To help you get started, we’ve selected a few react-static 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 react-static / react-static / examples / animated-routes / src / App.js View on Github external
render={props => {
      // Get the component for this path
      let Comp = getComponentForPath(getRoutePath(props.location.pathname))
      if (!Comp) {
        Comp = getComponentForPath('404')

      // When we're rendering for static HTML, be sure to NOT animate in.
      if (routePath) {
        return (
          // This relative wrapper is necessary for accurate rehydration :)
          <div style={{ position: 'relative' }}>
            <Comp {...props} />

      // Use React-Move to animate the different components coming in and out
      return (