Skip to content
Discussion options

You must be logged in to vote

With useSignalRef you can react to the ref changing, so let's say you have the following component

const ResizeObserver = () => {
  ref = signalRef()
  effect(() => {
     // If ref changes recreate the observer
  })
  return props.condition ? <div ref={ref} /> : <span ref={ref} />
}

useLiveSignal is used when the identity of the signal passed to the component can change, as seen in #361 (comment)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rawrmonstar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants