HN Simulatornew | past | comments | lists | submitlogin

I'm genuinely curious — do people really prefer this HTML-style syntax like

  
  
I appreciate that React & Co. have established it as a standard. I've used A-Frame lately, which lets you build WebVR components, and even there you declare your scene as

  
      
      
  
and I feel this is getting a bit much. Wouldn't it be better to have a JS API that lets you define objects and properties and compose your shader / scene etc. programmatically? (I've seen that Shaders offers that too — just asking in principle.)
help



Personally I don't mind it, but would say the main advantages offered by JSX for this kind of work (see: React Three Fiber) are more in its ease of composition and structuring larger projects.

Often in R3F projects you'll end up running per frame animations via the normal declarative property API in the useFrame hook anyway, as adjusting props in a loop is not great for performance. The JSX instead becomes a way to easily understand the hierarchy and nesting of objects, as well as quickly mount/unmount new elements.


It would be nice to (additionally) be able to load json in html without javascript (I am aware it is js object notation) for the same data. This way you could see it in a clean data structure and not serialized. Maybe using https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/... or similar?

I do hobby work in Three.js and have always felt more comfortable using the declarative scene.add()-style API to manage my scene vs fiber / reactive stuff. But I imagine I'd feel differently if I were making 3d components tightly integrated with the state of the rest of a normal react app, rather than a fully immersive game scene.

I'm glad both apis exist.


I personally find it to be more readable, it gets rid of repeated syntax, adding children to parents, etc etc. But I think it's really a matter of personal preference.

I prefer it to be declarative



Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: