Skip to content

Commit

Permalink
add a note about react compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 6, 2024
1 parent 19c5990 commit 40e2617
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/guide/extras/composition-api-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ React Hooks are invoked repeatedly every time a component updates. This creates

- The stale closure problem, combined with Concurrent features, makes it difficult to reason about when a piece of hooks code is run, and makes working with mutable state that should persist across renders (via `useRef`) cumbersome.

> Note: some of the above issues that are related to memoization can be resolved by the upcoming [React Compiler](https://react.dev/learn/react-compiler).
In comparison, Vue Composition API:

- Invokes `setup()` or `<script setup>` code only once. This makes the code align better with the intuitions of idiomatic JavaScript usage as there are no stale closures to worry about. Composition API calls are also not sensitive to call order and can be conditional.
Expand Down

0 comments on commit 40e2617

Please sign in to comment.