reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
11k stars 7.51k forks source link

[Typo]: Wrong directive name in `use no memo` note #6923

Closed devserkan closed 2 months ago

devserkan commented 4 months ago

Summary

The note says:

"use no memo" is a temporary escape hatch that lets you opt-out components and hooks from being compiled by the React Compiler. This directive is not meant to be long lived the same way as eg "use client" is.

It should be .. the same way as eg "use memo" i guess. Also, the link goes to use client directive reference page.

Page

https://react.dev/learn/react-compiler#use-no-memo

Details

No response

CuriousCoder00 commented 2 months ago

@devserkan I think that's already correct: beacuse use memo is a React Hook for memoizing values that lets you cache the result of a calculation between re-renders. whereas use client is a React directive that is commonly used or needed only if you’re using React Server Components or building a library compatible with them. The sentence is comparing the temporary nature of use no memo with something that is intended to be long-lived like "use client".

devserkan commented 2 months ago

Thanks! Although I'm quite familiar with useMemo and the differences between hooks and directives, I must have misunderstood something when I created this issue (or maybe I just needed more coffee). ie, they meant to clarify that there is and will not be a permanent directive like use memo. Interestingly, I don't recall why it should link to another thing. Anyway, thanks for your comment!