#Unable to use useNavigate inside async function and I don't know how to do this
1 messages · Page 1 of 1 (latest)
Unable to call useNavigate or UseRef, please let me know if there's anything else I need to clarify
You can't use any hooks outside of react components. To redirect from a loader or action import redirect from react-router and throw it.
throw redirect('/somewhere/to/go');
Thanks, let me try this
This worked but it's triggering a reload, are there any alternatives?
@cobalt roost It shouldn't be triggering a reload
Just made a little reproduction and you can see there's no full reload. The input in the root route maintains its state
Here's the code for the index route
There's the repo if you'd like to look
Thanks, I'll look into the repo it seems to be a mistake from my part, thank you really for being so helpful, am I supposed to use the action and loader with React js and resct-router-dom package?
Again, I just checked out the repo, it seems to be in remix and I'm using react, will that be an issue?
sheesh
legend out here helping people on discord
nice to see
🤘
big fan btw
i think i sent u a comment on x like way back
hahaha
yeah DMs still there
again big fan
good stuff
haha thank you brother!
Ah sorry I missed that. So using React Router + vite?
I believe it should be the same