Toot

Written by Thomas Michael Semmler on 2025-01-21 at 13:40

So, you're fetching data with #useEffect and you need to make a state update to set an error, when something along the line of the fetch went wrong. But the linter complains that you now need to include the error state variable in its dependency array. But now, when there is an error, it will run in a loop because it runs whenever the error state var is updated, which it does when there is an error.

What is the intended pattern here? #react #javascript #webdev

=> More informations about this toot | View the thread | More toots from nachtfunke@indieweb.social

Mentions

Tags

=> View useeffect tag | View react tag | View javascript tag | View webdev tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113866627347840725
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
222.515133 milliseconds
Gemini-to-HTML Time
0.606196 milliseconds

This content has been proxied by September (ba2dc).