Tecnocriollo
Apr 20, 2021

--

Very nice. But you need to separate about concerns. Your hook is about getting users so you could have named it useGetUsers or something like that. But I think is better you avoid hooks because you're making React dependent code. Maybe is better to create a component called usersApiClient with all CRUD methods and then use that in the hooks. That because you could have a new requirement to fetch the same data in another framework like Vue and it will be easier to migrate that part.

--

--

Tecnocriollo

CEO at PSA Solutions. Technocrat, i like software development and the way it helps people lives easier