react-static-plugin-react-router

A React-Static plugin that adds react-router support for React Static

Usage no npm install needed!

<script type="module">
  import reactStaticPluginReactRouter from 'https://cdn.skypack.dev/react-static-plugin-react-router';
</script>

README

react-static-plugin-react-router

A React-Static plugin that adds support for react-router

Installation

  • Install this plugin and peer dependencies:
$ yarn add react-static-plugin-react-router react-router-dom react-router

Make sure that you have exactly the same version for react-router-dom as react-router, per this blog post.

  • Add the plugin to your static.config.js:
export default {
  plugins: ['react-static-plugin-react-router'],
}
export default {
  plugins: [
    [
      'react-static-plugin-react-router',
      {
        RouterProps: {
          // These props will be passed to the underlying `Router` component
        },
      },
    ],
  ],
}