hi guys sorry idk why i cant make a
hi guys, sorry idk why i cant make a thread on my phone. i want to ask how to get history state when i try to pass data to next page with push on useNavigate. thabk you
13 Replies
yappiest-sapphire•3y ago
Hi @Izzati you can use
useNavigate
from @pankod/refine-react-router-v6
https://reactrouter.com/en/6.5.0/hooks/use-navigate
navigate
takes state object as a second argument. you can read from other page with useLocation()
's returning state object
It should work as expected. if you have problems please reproduce issue on code platforms. we are happy to debug 🙏compatible-crimson•3y ago
useLocation and useNavigate not available on @pankod/refine-react-router-v6 v3.33.2
compatible-crimson•3y ago

yappiest-sapphire•3y ago
i will debug and return you as soon as possible
compatible-crimson•3y ago
when i update version react-router-v6 my code look like this
yappiest-sapphire•3y ago
you can use like this but i strongly recommend update router v6 package
compatible-crimson•3y ago
only update @pankod/refine-react-router-v6 ?
compatible-crimson•3y ago
this is my pankod version

yappiest-sapphire•3y ago
yes, this will be enough in this case
compatible-crimson•3y ago
but i got errors like this
ill try use router
works!! thank you
compatible-crimson•3y ago
@alicanerdurmaz i cant consume location.state.foo bcos foo is uknown type

compatible-crimson•3y ago
im use typescript
yappiest-sapphire•3y ago
i will debug and return you
@pankod/refine-react-router-v6
is using react-router-dom@6.3.0
under the hood. in that version, state type is unkown
, but they fix in 6.4.0
we need to update react-router-dom
in refine .
until that, you can use like this: or you can use other workarounds.
do you wanna open issue on github ? if you open, we can speed things up.