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.

Migration instructions from react-router@3

See original GitHub issue

Hey, great project!

We use react-router@3 at the moment, but not really sure if migrating to @4 is going to happen any time soon, if ever. So, found looks like a great alternative as soon as some migration instructions from react-router will be available — I’m sure lots of people will appreciate that. Thanks

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

taioncommented, Nov 8, 2016

Good idea. For now, the capsule summary is:

  • getChildRoutes and getIndexRoute are gone; no replacement intended in the near future
  • route components use Component as the property rather than component
  • path matching now uses Path-to-RegExp, mostly matching the Express syntax; biggest change is that it’s now foo/:optionalParam? instead of foo(/:optionalParam)
  • top-level router setup looks a little different – see the examples; biggest change is that the route config is now static
  • no explicit default/index routes; they’re just routes without paths now
  • getComponent doesn’t take a callback for async any more; if you want it to be async, return a promise
  • onEnter and onChange are gone; you can do the same thing in render now by throwing a RedirectException, but you have to also return the element (by default just <Component {...props} /> if both are resolved)
  • onLeave is gone
  • transition hooks work differently; it’s router.addTransitionHook now, and they trigger on any navigation
  • router middlewares have been replaced by a couple of more specialized APIs (resolveElement and render on the router)
  • Found uses Redux and renders its own <Provider> by default; you’ll need to enhance your store per the docs if you’re using your own Redux store
idolizecommented, Apr 8, 2017

@taion Why the removal of onEnter and onLeave? I can see how the introduction of getData and render reduces the need for such explicit hooks, but I can still imagine some use cases for them (i.e. triggering an action to reset some redux state when the user leaves a given route).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating React v15.5 to v16.8 and react-router v3 to v5
This post might help you with the migration and it also includes other packages that you might need to update.
Read more >
Moving from react router 3.x to 4.x - Stack Overflow
You will be able to take routes one-by-one and migrate them to the new API. Additionally, the config addon mentioned above may help...
Read more >
Migrating React Router from 3 to 4 | Blog
I was working on understanding how to make React relevant beyond a single page app, and I came across this tutorial by Krithika...
Read more >
Upgrading from v5 v6.6.1 - React Router
The following is a detailed breakdown of each step that should help you migrate quickly and with confidence to v6. Upgrade to React...
Read more >
Migrating your React Router App to Remix
First, you'll need a few of our packages to build on Remix. Follow the instructions below, running all commands from the root of...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found