Skip to content
main logo
  • Blog
  • LinkedIn
  • GitHub
  • Recipes
Home » React

Category Archives: React

Cleanup Functions in React useEffect

When working with React’s useEffect hook we can add what’s called a “cleanup function”. This function is used to cancel any side effects that no longer require execution, before the component is unmounted. Why are cleanup functions useful? Using a cleanup function inside useEffect helps to prevent memory leaks or other errors when a side …

Continue reading “Cleanup Functions in React useEffect”

Async Functions in React useEffect

When using React’s useEffect hook we may want to write an asynchronous function, perhaps to fetch some data. There are some important considerations when combining async with useEffect, discussed further below. Don’t Do This The wrong way to write an async function with useEffect looks something like this: The main problem with the code above …

Continue reading “Async Functions in React useEffect”

© 2025 Neilson Web Design