pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.33k stars 177 forks source link

How to make react-router works? #330

Closed zzmingo closed 2 years ago

zzmingo commented 2 years ago

For examples:

function App() {
  return (
    <Stage>
      <Outlet/>
    </Stage>
  )
}

function Inner() {
  return <Sprite />
}

// render
<HashRouter>
  <Routes>
     <Route path="/game" element={<App />}>
       <Route path="/inner" element={<Inner />}/>
     </Route>
  </Routes>
</HashRouter>

Inner should be render when push path to /game/inner, but actually not.

inlet commented 2 years ago

Should work indeed, can you please create a sample on codesandbox/codepen? Thanks

zzmingo commented 2 years ago

After looking at ContextBridge, the issue was solved by bridging LocationContext and NavigationContext of react-router.