Attach ref.current once it exists — the element may be null for a frame (the provider mounts above the element it names), so retry on the next frame until it lands or the effect is torn down.
ref.current
Attach
ref.currentonce it exists — the element may be null for a frame (the provider mounts above the element it names), so retry on the next frame until it lands or the effect is torn down.