3min chapter

JS Party: JavaScript, CSS, Web Development cover image

JS logging & error handling

JS Party: JavaScript, CSS, Web Development

CHAPTER

Is Your React Component Doing a Lot of Work in the Background?

If you have a web server, and you're handling your request in a promise, then, say, the incoming request like times out, or the client dis connects. Then you might want to use the abort controller to fire a signal down to all the promises in that handler to tell them "don't waste any more resources handling this request" It can also be useful for react components when they mount but don't have all their state immediately. So what you probably want to do is have a hook that creates an abort signal, right? And then component unmounts. The umount Hook will basically fire off the abort signal and kill all those promises that respond by mounting that component.

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode