How to dynamically remove/add elements to Canvas #608
milenazuccarelli
started this conversation in
General
Replies: 1 comment
-
You can use react to mount and unmount elements in the scene, they are regular components const [show, toggle] = useState(true)
return (
<>
{show && <mesh>...</mesh>
<mesh onClick={() => toggle(!show)}>...</mesh>
</>
) When |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
I have a Canvas component and some links. Every time a link is clicked the content on the canvas should change, such as the meshes and their positions, but the lighting, post processing, etc. all remain the same. How can I dynamically remove all the children and replace them?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions