Preact with babylon js

Hello Guys,

I read that preact is much faster than react. So I was thinking to build my web app using preact although I have to integrate it with babylon js.

Is babylon js supported with preact ?

Thank you in advance !

Hello @Karim_Deiss,
React is just the UI library and Preact is trying to be the lighter version of React.

Answering to your question

I haven’t seen any existing library which marries (gives you out of a box examples) Preact with BabylonJS (as there are few of those for React and the BabylonJS).
But it should be possible as it is with React and because the Preact and BabylonJS are doing very different things. So it’s more like integrating the BabylonJS operating on canvas HTML element into your Preact / React application.

As the last words I’d say that I don’t know why do you worry about the speed of the application at the very beginning but I would advise you to just play around with the React and BabylonJS as there are working examples and if you will need something faster then we can talk again :slight_smile:

Totally agree with @neu5 you should be able to heavily inspire yourself from the great work of @brianzinn with React and Babylon

2 Likes

Thank you @neu5 for your reply.
I just read manipulating elements in preact is much faster than react and in my work any performance benefits from preact will be great for us with Babylon so that’s why I’m asking

I don’t know what experience do you have with React and Preact.

This kinds of performance measurements are usually taken in the laboratory like environment and not in real life application. We are still talking about ms vs ms. There are a lot of ways to make your application slow :slight_smile:
Depending on what kind of application you’re working on - is it some hobby project just for you, or is it going to be top notch enterprise level - you may need different things.
Maybe with Preact you can get faster manipulating on elements but also you “get” less features, less known library which means worse support, smaller community etc. which usually means slower development and more difficult maintenance in general.
I work with React daily, I did with it several projects, there were times when we needed to optimise it a little bit but usually it was our not the best approach from the beginning and not “slow framework”.
So depending on your need and what you’re building choose your toolset :slight_smile:
Also, React and Preact have similar APIs so if you will start with one it should be fairly easy to switch to the second one - but on the early stage of the application.