Skip to content

Commit

Permalink
Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
poteto committed Mar 8, 2024
1 parent d717b51 commit 9a8fc09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Try building a component that displays the time in real-time in our [challenge](
## Side effects must run outside of render {/*side-effects-must-run-outside-of-render*/}
Side effects should not run in render, as React can render components multiple times to create the best possible user experience.
[Side effects](http://localhost:3000/learn/keeping-components-pure#side-effects-unintended-consequences) should not run in render, as React can render components multiple times to create the best possible user experience.
While render must be kept pure, side effects are necessary at some point in order for your app to do anything interesting, like showing something on the screen! The key point of this rule is that side effects should not run in render, as React can render components multiple times. In most cases, you'll use [event handlers](learn/responding-to-events) to handle side effects.
Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We strongly recommend using Strict Mode alongside React's ESLint plugin to help

You can think of React's constraints like the grammatical rules and patterns of languages: they constrain what we can do with words, so that we can correctly and efficiently communicate our thoughts.

These rules have been used in the design of all of React's features over the years. React's Strict Mode enforces several of these rules at runtime in DEV mode, and with the release of React's upcoming compiler, more rules will now be statically checked to help you find more bugs as well as allow for correct optimisation of your code.
These rules have been used in the design of all of React's features over the years. React's Strict Mode enforces several of these rules at runtime in DEV mode, and with the release of React's upcoming compiler, more rules will now be statically checked to help you find more bugs as well as allow for correct optimization of your code.

The Rules of React are proven rules used at companies like Meta that help you maintain an application and codebase that scales with you. When followed, your codebase becomes easier to understand and maintain, is less buggy, and helps React ensure your code runs efficiently by default.
</DeepDive>
Expand Down

0 comments on commit 9a8fc09

Please sign in to comment.