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.

Discuss: Improvements to Navigation

See original GitHub issue

Currently, we are using React Router together w/ Ion (our prototype global state management solution) to handle site navigation. There are a couple of potential issues with this that I wanted to discuss…

Avoid Tightly Coupling React Router w/ Ion (or any other global state)

At the moment, we can “redirect” to another screen in the app by setting a key in Ion. This seems convenient, but I wonder if it’s actually necessary and can’t think of any great reasons why we should do this. If we are sticking with React Router then we already more or less get global app navigation for free (while inside components at least) - see withRouter HOC.

While working through some bugs in the codebase I found it very confusing to tell what sorts of things would cause a redirect and we should try to be as predictable as possible when it comes to redirects that are side effects of making API calls etc.

As far as I can tell there is no use case for storing a redirect direction in a persistent way. And in my opinion site redirects should be instant (e.g. this.props.history.push() or a <Link/>) and not need to touch Ion code at all.

Ultimately I think our site navigation strategies need to be:

  1. Well documented
  2. Predictable
  3. Easy for engineers to follow and implement

If we don’t do this then we will likely find ourselves chasing down bugs or introducing hacks to overcome poorly understood redirect logic. Which will translate to a more brittle system that can easily be broken and possibly not caught in regressions tests. Which is obviously bad for the user.

Using React Navigation

This might require further investigation but I believe by using React Router on native mobile we are losing some of the features of native app navigation. I’m thinking of things like tab navigators, drawers, Android back button, etc. In the prototype, we get around this by using some simple views and animations to create a slide out drawer navigator. Based on this I believe it would be possible to integrate something like react-navigation with RN4W (React Native for Web).

Don’t hate me. I haven’t quite done this research yet to see how feasible it would be to combine React Navigation with RN4W but my rough hypothesis here is… we should explore using React Navigation because it takes advantage of existing native app navigation patterns and will feel more natural + possibly have better performance than React Router when run on mobile apps - which are arguably the most important platform we have.

https://reactnavigation.org

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
AndrewGablecommented, Aug 19, 2020

From what I can tell… Yes we can still have URL routes: https://reactnavigation.org/docs/configuring-links

0reactions
Julessssscommented, Jan 19, 2021

Hmm, perhaps I should have opened the internal issue instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

6 Easy Ways To Improve Your Site's Navigation
Keep it consistent. Consistent navigation – in both how and where it appears on your site – promotes ease of use and increases...
Read more >
4. Improvements in navigation - YouTube
John Hooper uses this lecture to introduce you to the topic of navigation. John starts the lecture by reviewing the information needed by ......
Read more >
What was the effect of navigation improvements in world history?
In general, navigation improvements have helped bring the world closer together. More specifically, navigation improvements such as the magnetic compass, ...
Read more >
Navigation | Definition, History, Measurements, & Facts
navigation, science of directing a craft by determining its position, course, and distance traveled. Navigation is concerned with finding the way to the ......
Read more >
Best Ways For Improving Your Website Navigation
Additional Navigation Website Improvement Tips · Consistent navigation: Your navigation menus should be built in a way that makes sense so users ...
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