You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use a signal value defined in ReactAdapterElement in the render method. Changes to the signal value do not trigger re-rendering the same way is in React components in Hilla. For consistency, it would be nice if we could use signal values in the template here too.
classMarkdownElementextendsReactAdapterElement{markdown=signal('');asyncconnectedCallback(){awaitsuper.connectedCallback();// Gets triggered when the value changeseffect(()=>console.log(this.markdown.value));}protectedoverriderender(){// Does not get re-rendered when the value changesreturn<ReactMarkdown>{this.markdown.value}</ReactMarkdown>;}}
Describe the solution you'd like
I would like to be able to use signal values in ReactAdapterElement the same way I can in Hilla React components, as shown in the code example above.
Describe alternatives you've considered
I got it working by passing the signal value into a useState hook. It's not pretty and maintains the same state twice for no good reason.
Describe your motivation
I'm trying to use a signal value defined in
ReactAdapterElement
in the render method. Changes to the signal value do not trigger re-rendering the same way is in React components in Hilla. For consistency, it would be nice if we could use signal values in the template here too.Describe the solution you'd like
I would like to be able to use signal values in
ReactAdapterElement
the same way I can in Hilla React components, as shown in the code example above.Describe alternatives you've considered
I got it working by passing the signal value into a
useState
hook. It's not pretty and maintains the same state twice for no good reason.Additional context
@Legioth says: everything should be a signal.
The text was updated successfully, but these errors were encountered: