Babylon and the Functional Component React template

I have noticed that the scene recompiles and restarts if the functional component is modified at all, is there anyway to prevent that? If not then that react deploy is kind of broken, I am prolly doing it wrong though.

Just seems like its more for creating a scene that is static as far as its dom/canvas element. My solution was to remove the render from the component but that is creating some issues with the observables half work half dont its kinda odd… but it did stop the component from remounting when its modal its parented to is moved.

Im sure there is something I am missing and figured someone who knows better could relay some input.

Hello which component are you referring to? The @brianzinn’s one?

Do you have any code to share? I don’t know if you mean fast refresh recompile or prop changes forcing a re-render. React.memo may be what you are after:
React Top-Level API – React (reactjs.org)

Have a look at this as well - I saw your cool demo with lots of open windows. If you are re-parenting the canvas it will force unmount otherwise - I have not used this component myself, but it seems like it may address the problem you describe:
httptoolkit/react-reverse-portal: Build an element once, move it anywhere (github.com)

1 Like

booom thank you sir, that’s prolly the info I needed. I appreciate you! <3

Dude, memo is really gonna help me a ton. Thank you.

1 Like