-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I want to switch to preact-iso's router but find it's very cumbersome to get a hold of its route()
function in class components (as I can't use useRoute()
).
I've managed to do it, but it's not pretty:
import { Component } from 'preact';
import { Router } from 'preact-iso';
class C extends Component {
render() {
return (
<Router.Provider.ctx.Consumer>
{ ctx => (
<div onClick={ event => ctx.route('/some/place') }>Click me!</div>
)}
</Router.Provider.ctx.Consumer>
);
}
}
Describe the solution you'd like
In preact-router, I could just do:
import { route } from 'preact-router'
and then use route()
pretty much anywhere.
My guess is that preact-iso probably switched to useRoute()
for a reason and that the import { route }
isn't entirely 'compatible' anymore, but I would appreciate it if there was a better way to get a hold of it :)
Thanks!
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request