Honest question: I get why React has created the naming convention of "use*" for their hooks API. It makes sense to me. But why is in Dioxus creating a new signal called "use_signal"? This function call creates a new signal, doesn't it? The signal is not recreated on every rendering (that's the whole point of signals).
let mut count = use_signal(|| 0);
In SolidJS you create a signal with createSignal, which makes much more sense to me.
const [count, setCount] = createSignal(0)
The naming of the API matters, because state hooks behave much differently and might have complementing needs like "useMemo".
Is there a reason Dioxus for the "use_signal" naming other than trying to be close to React?
Dioxus still re-renders components but throws a lot of optimizations at the rsx that components generate, getting it close to solid's performance. It's more like preact than it is solid.
Optimizations include:
- splitting out dynamic pieces of the UI into their own "diff bin"
- memoizations by default
- signals implicitly marking attributes as dirty / managed
Very interesting, thanks. I wished / wondered back when I was on a React project, why the memoization can't be turned on by default. I felt performance opt was left to the dev in React. Dioxus seems to have taken this into the framework, which I think is a great decision.
Is there a reason Dioxus for the "use_signal" naming other than trying to be close to React?