3 ms·
Isn't useSyncExternalStore the recommended hook for API requests? And for making API requests I think most people recommend using a library. React-query, RTK or
by andix 3y ago
Isn't useSyncExternalStore the recommended hook for API requests? And for making API requests I think most people recommend using a library. React-query, RTK or swr for example.
For accessing browser apis useEffects are the way to go, but those are usually extremely easy to understand in my experience. Or just use a library that provides the needed functionality.
- rmccue 3y agoPer the blog post announcing it, it's not recommended that you use that hook directly, only in libraries: > useSyncExternalStore is intended to be used by libraries, not application code. https://react.dev/blog/2022/03/29/react-v18#usesyncexternalstore https://react.dev/blog/2022/03/29/react-v18#usesyncexternals...