gre / gl-react

gl-react – React library to write and compose WebGL shaders

Home Page:https://gl-react-cookbook.surge.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unnecessary span tag?

rockmandash opened this issue · comments

Hello, first of all, thanks for this wonderful library.
This library is so killed.
But I wonder there is a lot of span tags out there.
Is there any particular reason?
Can we replace it with fragment?
Thank you very much.

Yeah maybe we can replace with Fragment. this is historic reason before fragment existed.
The usecase is legit because basically you are allowed to have DOM element inside GL components and they need to be mounted somewhere.. in dom implementation, i figured out we can put the DOM straight inside the <canvas>, it works & just don't display anywhere which is exactly what I needed.
(examples https://gl-react-cookbook.surge.sh/textfunky | https://gl-react-cookbook.surge.sh/video ...)

Another interesting fact is that, since the DOM exists, you can actually inspect with React inspector and see the stack of components. If it is still the case for React.Fragment then we could probably migrate all the spans to it.

Thank you for your reply.