Skip to content

Is storing JSX.Elements in an observable supported? #3418

Answered by urugator
johnmcconnell asked this question in General
Discussion options

You must be logged in to vote

You can store a reference to an element, but you should treat the element itself as immutable and mark the field as observable.ref.

It's usually better to store react's ref object instead of the element directly. Otherwise make sure to pass a callback to ref={el => store.el = el}.

Don't call it component. Component is a function/class, element is an object.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

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