Skip to content

Conversation

gaearon
Copy link
Member

@gaearon gaearon commented Oct 1, 2025

These docs are misleading. We do have an official API that relies on setting state in render. If we don't like it, we should come up with a more first-class API for this occasionally legit pattern. But the API is legit and supported.

This clarifies the docs to resolve the contradiction. Only unconditional setState in render is definitely disallowed. Conditional is more nuanced, as noted.

Copy link

github-actions bot commented Oct 1, 2025

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@gaearon gaearon merged commit 10e5ad5 into main Oct 1, 2025
8 checks passed
@gaearon gaearon deleted the gaearon-patch-1 branch October 1, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants