-
I would like to use react three fiber to create objects and add them manually to the scene. For example: Let's say we have a GridHelper.jsx file which is configuring the Grid with it's defaults.
Now, in the another file, I would like to be able to manually create it like this:
Is there a function to transform react three fiber element to threejs Object and manually add it into the scene? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
this is not react im afraid. you never call add/remove imperatively. the whole point of react is that you lay out the scene declaratively, it is always returned in a function, it is the outcome of state. all composition is functional: function GridHelper({ children }) {
return (
<>
<Grid ... />
<Center top>
{children}
</Center>
<GridHelper>
<mesh /> |
Beta Was this translation helpful? Give feedback.
this is not react im afraid. you never call add/remove imperatively. the whole point of react is that you lay out the scene declaratively, it is always returned in a function, it is the outcome of state. all composition is functional: