1

PHOTO EMBED

Sat Oct 15 2022 15:46:09 GMT+0000 (Coordinated Universal Time)

Saved by @Vrushabh_123

const someFunction = () => {
  // do anything in the function
}

function TheComponent() {
  useEffect(someFunction) // you pass the function you want to run after every render

  return <div>.....</div>
}

// However, generally this whole process is short-circuited by using
// an anonymous arrow function directly in useEffect()
function TheComponent() {
  useEffect(() => {
    // do anything you want to do here.
  })

  return <div>.....</div>
}
content_copyCOPY