I think it's great to have a repo of all the hooks, but I wonder if implementing each from scratch is the right approach. For example, there is an exceptional useDebounce package [0] that handles many more cases than the simplified one on UseHooks, and I think it could be even more useful to highlight exceptional work that has already been done and maintained in the community rather than in-housing everything. I also…
I don’t want to pull in one package for every little piece of functionality. I prefer a package, that includes a bigger set of hooks that I can use. For example like date-fns for date/time.
UseHooks – A Collection of Server Component Safe React Hooks
41–50 of 62 posts
Re: UseHooks – A Collection of Server Component Safe React Hooks
#42How telling is it that a basic core function like useFetch has a warning that it “depends on React’s experimental useEffectEvent”? Almost a decade later and simple data fetching is still an unsolved “problem” in React land.
Re: UseHooks – A Collection of Server Component Safe React Hooks
#43Earlier quoted context omitted.
Yeah it's [poor phrasing]( https://twitter.com/tylermcginnis/status/1663648010558132224 ) on our part. How it's being interpreted vs how I thought it would be interpreted are different. We'll update it.
I don't blame you for this. The React team recently talking about "React Server Components" as though most React users are running it on NodeJS backends and introducing magic "use client" strings is putting everyone in a confused position and I don't think there's a good phrasing for you.
And people suggest juniors to start on the front-end because it's less complicated...
Re: UseHooks – A Collection of Server Component Safe React Hooks
#44I strongly dislike having to think about the color of functions while I’m programming. I want the type system to know
Re: UseHooks – A Collection of Server Component Safe React Hooks
#45https://usehooks.com/uselocalstorage
On their main website Nada, within the github, searching for it only turns up the docs implementation and not the actual source?
Re: UseHooks – A Collection of Server Component Safe React Hooks
#46Earlier quoted context omitted.
Are all the hooks on the site made by ui.dev? It'd be great if each hook linked to the Github code for that hook, as the first thing I thought of was (a) what is the hook doing, and (b) is it easier to adapt my existing hook and reduce the number of dependencies I have to track?
Good feedback. Yes they're all up on Github – https://github.com/uidotdev/usehooks
Re: UseHooks – A Collection of Server Component Safe React Hooks
#47I don't know if I'm being silly, but I'm trying to find the source behind useLocalStorage https://usehooks.com/uselocalstorage On their main website Nada, within the github, searching for it only turns up the docs implementation and not the actual source?
Re: UseHooks – A Collection of Server Component Safe React Hooks
#48I don't know if I'm being silly, but I'm trying to find the source behind useLocalStorage https://usehooks.com/uselocalstorage On their main website Nada, within the github, searching for it only turns up the docs implementation and not the actual source?
Re: UseHooks – A Collection of Server Component Safe React Hooks
#49https://github.com/uidotdev/usehooks/blob/380e83fa267157832e...
Re: UseHooks – A Collection of Server Component Safe React Hooks
#50How telling is it that a basic core function like useFetch has a warning that it “depends on React’s experimental useEffectEvent”? Almost a decade later and simple data fetching is still an unsolved “problem” in React land.
react is a rendering engine, not a framework; there is no opinionated way to fetch data. react-query is a delightful library that has made data fetching/cacheing a breeze for me - https://tanstack.com/query/v3/docs/react/overview
In fact, the toolbox this whole HN entry is about is a great example of how React is not just a rendering engine. It wouldn’t even be necessary otherwise. Peek at the code and what you’ll see is intense use of a DSL and built-in methods provided by React, to wrap native APIs that are otherwise usable without any wrappers.
I’m also a happy user of react-query, but it uses the same underlying hooks which are a moving target.