Join Slack
Powered by
How would I create a react element and store it in...
# react
o
OrfeasZ
04/15/2023, 11:40 PM
How would I create a react element and store it in a variable instead of adding to the children of the component currently being rendered? I basically want to do the equivalent of this in JSX:
const x = <div>Hello</div>
and then later use
x
somewhere in my component.
s
Steven
04/16/2023, 8:19 AM
you can create it like this
val x = div.create { +"Hello" }
and add it with
+x
o
OrfeasZ
04/17/2023, 3:47 PM
Thanks!
3
Views
Open in Slack
Previous
Next