Skip to content

Conversation

candymask0712
Copy link
Contributor

image
  • When I first read the explanation, it felt as if redirect couldn’t be used in client components.
  • Also, when clicking the Server Components link, it leads to the Server and Client Components page.
  • To indicate that redirect can be used in both server and client components, rename the hyperlink text in the redirect.mdx file.

… components, rename the hyperlink text in the redirect.mdx
@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Jul 27, 2025
@ijjk
Copy link
Member

ijjk commented Jul 27, 2025

Allow CI Workflow Run

  • approve CI run for commit: fe89127

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@icyJoseph
Copy link
Contributor

Do you mean here, using redirect as you render in SSR?

Cuz within event handlers, redirect won't do its thing, right?

@candymask0712
Copy link
Contributor Author

@icyJoseph
Yes, you’re correct that redirect won’t work inside client event handlers.
The intention of this PR is to clarify that redirect can be used in both server and client components (outside of event handlers),

Would it be better to explicitly add wording here?

@icyJoseph
Copy link
Contributor

We do have this in this docs page:

  • redirect can be called in Client Components during the rendering process but not in event handlers. You can use the useRouter hook instead.

Maybe we can reword your change to:

redirect can be used while rendering Server and Client Components, Route Handlers, and Server Actions.

@candymask0712
Copy link
Contributor Author

@icyJoseph
I like the phrasing you suggested. Thank you. 👍

@icyJoseph icyJoseph merged commit 5083e60 into vercel:canary Aug 1, 2025
63 checks passed
bgub pushed a commit that referenced this pull request Aug 1, 2025
#82092)

<img width="591" height="132" alt="image"
src="https://github.com/user-attachments/assets/9c9c64fe-4095-4127-a893-1c12426d9700"
/>

- When I first read the explanation, it felt as if `redirect` couldn’t
be used in client components.
- Also, when clicking the `Server Components` link, it leads to the
`Server and Client Components` page.
- To indicate that `redirect` can be used in both `server and client
components`, rename the hyperlink text in the `redirect.mdx` file.

---------

Co-authored-by: Joseph <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Documentation Related to Next.js' official documentation. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants