12 days ago
Work in ProgressWhat new in React 19
React
Use
use is not a hook but API, even though hooks are typically prefixed with use, I was reading documentation and found this interesting
a React API that lets you read the value of a resource like a Promise or context.
At first, i thought there was nothing wrong with the current way of handling promise or context, for promise especially in case getting data from backend, i usually use Fetch API within useEffect
. Last for reading context, even though i rerely use it now, because i often use Jotai or Zustand for global state. React already provides useContext
for using context. Both cases don't really have any issues, So why "use" exists then?