2019-10-03
2407
#react
Raphael Ugwu
7334
Oct 3, 2019 ⋅ 8 min read

Popular React Hook libraries

Raphael Ugwu Writer, software engineer, and a lifelong student.

Recent posts:

React logo on a bubbly orange background. Guide on building adaptive and responsive UIs in React Native for diverse devices.

Creating adaptive and responsive UIs in React Native

Design React Native UIs that look great on any device by using adaptive layouts, responsive scaling, and platform-specific tools.

Chinwike Maduabuchi
Nov 15, 2024 ⋅ 9 min read
Enhancing Two-Way Data Binding In Angular

Enhancing two-way data binding in Angular

Angular’s two-way data binding has evolved with signals, offering improved performance, simpler syntax, and better type inference.

Alexander Godwin
Nov 14, 2024 ⋅ 6 min read
Hand holding purple sticky notes for CSS sticky positioning guide.

Troubleshooting CSS sticky positioning

Fix sticky positioning issues in CSS, from missing offsets to overflow conflicts in flex, grid, and container height constraints.

Ibadehin Mojeed
Nov 13, 2024 ⋅ 5 min read
Task Scheduling and cron Jobs in Node Using node-cron

Scheduling tasks in Node.js using node-cron

From basic syntax and advanced techniques to practical applications and error handling, here’s how to use node-cron.

Godwin Ekuma
Nov 12, 2024 ⋅ 7 min read
View all posts

3 Replies to "Popular React Hook libraries"

  1. Raphael, thanks for your article. I appreciate it!

    One thing that your code example doesn’t touch upon is where to where not to make useFetch calls. I went down a very wrong path by making such calls from event handlers like onClick, onChange, etc. If anyone reading this does the same, try a simple test with your code: Make a call to a given endpoint and then make the same call a second later. In many cases, the second call will not go out because the dependency(s) in the useEffect that makes the ajax call haven’t changed.

    Reading this article, and the comments therein, really helped me: https://blog.logrocket.com/frustrations-with-react-hooks/ Now, the only way I’ll make an ajax call is either: In a useEffect upon loading -or- by setting a local state or context property, which is a dependency of a useEffect and thus forces the code in that useEffect to be executed. The response data will then either populate a local state or context property, which in turn changes the appearance/behavior of a React component element.

    Changing my coding practices with React Hooks in this manner was a definite paradigm switch but one where things now work and there are no longer any “mysterious” bugs.

  2. Hi Robert,

    I’m glad you like my article. Thanks for the positive words.

    Your comment is very insightful, I haven’t tested for edge cases with the useEffect hook but this right here has prompted me to do so. Paul’s article which you recommended was also insightful as well. I will definitely be updating this post and its code demo with my findings.

  3. OMG I sooooo want to save others the wrong path I went down. My little litmus test of calling the same endpoint twice in succession is a super one to avoid the terrible bug I encountered.

    If I can get permission from my employer, I would love to publish the best practices code to use the Context API, useEffect, and calling API Endpoints that I’ve learned over the past few months.

Leave a Reply