JavaScript wrangler.
Check out my books!
Web API Cookbook:
https://www.amazon.com/Web-API-Cookbook-JavaScript-Applications/dp/1098150694
Modern CSS:
https://www.amazon.com/dp/148426293X
Using an isMounted approach is somewhat of an antipattern, whenever possible it's better to cancel the request (in the fetch example, you can use AbortController to cancel the request).
Thanks for this. I do know using the mounted approach is probably not the best way, but it's a way around it.
I will try using the AbortController as suggested.
Thanks.
Using an
isMounted
approach is somewhat of an antipattern, whenever possible it's better to cancel the request (in the fetch example, you can useAbortController
to cancel the request).Thanks for this. I do know using the
mounted
approach is probably not the best way, but it's a way around it.I will try using the
AbortController
as suggested.Thanks.
yeah. I don't like using
isMounted
, but in React component this is maybe the common way to handle the unmount componentCan you say more about why using the
mounted
variable is an antipattern? Thanks!