What should be the type of prop that needs to be passed to "to" option of redirect function
Similar question: https://discord.com/channels/719702312431386674/1210385988732325888
I have a component that accepts a redirectTo props. I use this redirectTo prop to pass to redirect function. ex:
Although
{redirectTo: string} works but I want the typing to be more strict. What should be the type ?
I tried
But I'm unable to get the autocomplete working for redirectTo prop2 Replies
vicious-gold•2y ago
If you just want auto-complete for the all the possible
to paths, then you could do this.
But this ideally wouldn't really trigger a redirection since the redirect helper is only meant to be used in the beforeLoad and loader callbacks. Plus, these types are more for internal use, and we don't really guarantee their stability since you are supposed to only be using the user facing apis.
For navigating between pages, you are better of calling the navigate function returned by the useNavigate hook.
adverse-sapphireOP•2y ago
@Sean Cassiere Thanks.