I've been looking to use Reach Router on my project, however it appears that it's not compatible with Preact.
I believe the issue is that the props created by Reach Router are not being passed down to the components and not causing a re-render as expected.
The URL updates so the History API part seems to be okay. The problem seems to be more related to the preact compat not handling the props appropriately. This is working fine with React.
Please see the examples below.
Hey @CedarDCX
This issue will be resolved when the new version of Preact will be released, this is an issue with our context Consumer bailing out of rerendering. You'll see that this is working with previous rc versions (tried with rc.1).
That's great, thank you for your help @JoviDeCroock . I can confirm it works with rc.1.
Closing this ticket.
@CedarDCX how did you make it work?
Could not find dependency: 'preact-compat' relative to '/node_modules/@reach/router/index.js'
I always got this ^^^ error, when I try to use the 10.1
https://codesandbox.io/s/blissful-hertz-yz75i?fontsize=14&hidenavigation=1&theme=dark
@montyx99 preact-compat is for preact 8, use preact/compat for preact 10 instead
Thanks a lot, I'm going to test is. Honestly I've never noticed before that there is a / sign instead of a -. I'm so sorry for that.
There might be an issue with the codesandbox preact-cli template
Most helpful comment
@montyx99
preact-compatis for preact 8, usepreact/compatfor preact 10 instead