-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow URL change but block routing #455
Comments
You might be able to hack this in with
ymmv |
What you want to do is route the new URL to the same component is all, and handle the changed router state from there. You can't skip the router without making the new URL unusable. For example, import { Router } from 'preact-router';
function ExampleRoute({ optionalId }) {
return (
<div>
{optionalId && <h1>Pretend I'm an overlay</h1>}
<h1>Show overlay via link</h1>
<a href="/12345">Click here</a>
</div>
);
}
export function App() {
return (
<div>
<Router>
<ExampleRoute path="/:optionalId?" />
</Router>
</div>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)
Maybe something like
onChange
that's for exampleor:
The text was updated successfully, but these errors were encountered: