Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request]: When to use useNavigate vs redirect #820

Closed
klequis opened this issue Jul 19, 2024 · 1 comment · Fixed by #904
Closed

[Request]: When to use useNavigate vs redirect #820

klequis opened this issue Jul 19, 2024 · 1 comment · Fixed by #904
Labels
solid-router Related to Solid Router

Comments

@klequis
Copy link
Contributor

klequis commented Jul 19, 2024

What is this request related to?

Request

📋 Suggested

And maybe in here as well: https://docs.solidjs.com/solid-router/reference/primitives/use-navigate

📋 General description or bullet points

Solid router has useNavigate and redirect. It wasn't clear to my why. I asked in Discord

@klequis

└── 📁categories
    └── [...notfound].jsx
    └── keyboards.jsx
    └── mice.jsx

I want [...notfund].jsx to redirect/navigate to /products/index.jsx. Does it matter if I use redirect vs useNavigate?

And got an answer from Ryan I would not have thought of:

"redirect actually only works inside cache and action functions (edited)
everywhere else useNavigate"

This seems like a good add to the doc.

🖥️ Reproduction of code samples in StackBlitz

No response

@klequis klequis added the pending review Awaiting review by team members. label Jul 19, 2024
@LadyBluenotes LadyBluenotes added improve documentation and removed pending review Awaiting review by team members. labels Aug 27, 2024
@LadyBluenotes LadyBluenotes removed their assignment Aug 27, 2024
@brenelz
Copy link
Collaborator

brenelz commented Sep 26, 2024

We could probably add a note to the redirect page that it only works in cache/action functions. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solid-router Related to Solid Router
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants