Skip to content
RED SAG Skills
hardStudy question · answer published in React interview questions, so no pointsreactrefsreact-19

Cleanup from a ref callback

In React 19, a ref callback starts a ResizeObserver on a node. What is the new way to stop it when the node is removed?

<div ref={(node) => {
  const ro = new ResizeObserver(onResize)
  ro.observe(node)
  /* ? */
}} />
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions