question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the purpose of `react-static-routes`

See original GitHub issue

Is it just a convenience method? Would there be any adverse effects to using a raw <Switch> component instead?

Edit: Which file has the source code for this import? I would like to read the source for myself.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DanWebbcommented, Jan 12, 2018

Sorry for not replying sooner I did solve this one, I had to delete react-static-routes out of node_modules and package.json otherwise it pulls in the wrong package, like @tannerlinsley suggests it’s a dynamically generated file per build not a module installed through npm.

In my case I incorrectly ran npm i -S react-static-routes without thinking much into it because my linter was complaining the package wasn’t listed.

I think it may be worth noting in the docs somewhere.

1reaction
DanWebbcommented, Dec 29, 2017

I’m seeing this issue on react static 4.7.1, react router 1.0.0, macOS High Sierra 10.13.2

When I attempt to build it provides the same error Error: Cannot find module 'react-static-routes'

My npm scripts look like this

  "scripts": {
    "start": "NODE_ENV=development react-static start",
    "build": "react-static build",
    "serve": "serve dist -p 3000"
  },

start continues to work as expected but build is still giving the error after re-installing all the dependancies.

I can see a dist/react-static-routes.js file is generated but all that’s in node_modules/react-static-routes is a package.json file, is that normal?

Let me know if you need any further info on this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

StaticRouter - React Router: Declarative Routing for React.js
A <Router> that never changes location. This can be useful in server-side rendering scenarios when the user isn't actually clicking around, so the...
Read more >
Dynamic vs Static Routing in React | by Chameera Dulanga
In static routing, you need to define all the routes in a centralized location in your application. Then these routes will be imported...
Read more >
Advantages of dynamic vs static routing in React
An advantage of static routing is that it allows for inspection and matching of routes before rendering. Hence it proves useful especially on ......
Read more >
The Hitchhiker's Guide To React Router v4 - freeCodeCamp
React Router introduces a concept called “Dynamic Routing”, which is quite different from the “Static Routing” we are used to.
Read more >
react-static-routing - npm
Static route for TypeScript, for TS lovers ♥!. Latest version: 1.3.2, last published: a year ago. Start using react-static-routing in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found