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.

Feature request: Programatic navigation

See original GitHub issue

I’ve ended up using this action to navigate between pages:

  effects: {
    navigate: (action, state, send) => {
      send('app:location', {location: action.location});
      window.history.pushState({}, null, action.location);
    }
  }

It’d be nice if there was an officially recommended way to do it. (This or something else.)

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
timwiscommented, Jun 26, 2016

Hey @josephg, we were just talking about this (see #21). It looks like the best way may be to use the native DOM API (window.location.hash = 'foo'). For browser history, I can’t member if it’s window.location.url or pushState as you have above. But the point is, adjusting those triggers the internal router. And the nice thing about this is that you don’t have to memorize a new framework-specific way to change the page/URL. How’s that sound?

1reaction
yoshuawuytscommented, Dec 12, 2016

Yup I think this should all work now in v4 - closing! 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Requests | React Navigation - Canny
One way to solve this is have a way to tell react-native-screens to "hang on to" the currently active ViewController (store the pointer...
Read more >
Feature request package.json & programmatic usage · Issue #11 ...
First of all this seems like an amazing module! Amazing job! It would be pretty awesome if the vscode plugin could show approx....
Read more >
Interact programmatically with the Navigation component
The Navigation component provides ways to programmatically create and interact with certain navigation elements.
Read more >
Programmatic navigation using React Router - Sentry
In React Router v6, you can use the useNavigate hook. It returns a function that lets you navigate programmatically. import { useNavigate }...
Read more >
Modern client-side routing: the Navigation API
First is programmatic navigation, where navigation is caused by a method call inside your client-side code. You can call navigation.navigate('/another_page') ...
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