You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using <Match /> before <Route history={createHashHistory()} /> will try to match non-hash history so the <Router /> component must be rendered before using match.
importRouterfrom'preact-router';importMatchfrom'preact-router/match';// this will fail// when rendering https://host/path#/subpath it will take /pathrender(<div><Match>{({ path })=><pre>{path}</pre>}</Match><Routerhistory={createHashHistory()}><divdefault>demo fallback route</div></Router></div>);// this will match correctly// when rendering https://host/path#/subpath it will take /subpathconstcustomHistory=createHashHistory()render(<div><Routerhistory={customHistory}/><Match>{({ path })=><pre>{path}</pre>}</Match><Routerhistory={customHistory}><divdefault>demo fallback route</div></Router></div>);
The text was updated successfully, but these errors were encountered:
Using
<Match />
before<Route history={createHashHistory()} />
will try to match non-hash history so the<Router />
component must be rendered before using match.Also
<Link />
activeClassName is affectedRepository https://github.com/sebasjm/preact-router-match-history-issue
To reproduce, go to profile and refresh the page. The upper header will take the path as / but the lower header will take the correct one.
Using preact-router@3.2.1
Maybe exporting an init function to set this
customHistory
before rendering?https://github.com/preactjs/preact-router/blob/main/src/index.js#L14
The text was updated successfully, but these errors were encountered: