Skip to content

Allow URL change but block routing #455

@foxt

Description

@foxt

Hello,

Is it possible to allow the URL to change, but leave the content of the router as is. For example, if I have the following code to show content outside of the router dependent on the path (think Twitter's old design, where tweets would open over top of the content you was looking at, but still changed the URL)

  <div>
    <Match path="/accountSettings">{({ matches }) => matches && <AccountDetailsModal />}</Match>
    <Router>
		<AsyncRoute path='/' .../>
		<AsyncRoute path='/foo' .../>
		<AsyncRoute path='/bar' .../>
	</Router>        
  </div>

Maybe something like onChange that's for example

canRoute={(e) => 
    if (e.url == '/accountSettings') return false;
    else return true;
}}

or:

<Router>
		<AsyncRoute path='/' .../>
		<AsyncRoute path='/foo' .../>
		<AsyncRoute path='/bar' .../>
		<FakeRoute path='/accountSettings' />
</Router>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions