3 ms·
I recently took Solid for a spin and I found none of that 2-way data binding mess you complain about. To be fair, I think you’re assuming is has behavior that i
by skrebbel 3y ago
I recently took Solid for a spin and I found none of that 2-way data binding mess you complain about. To be fair, I think you’re assuming is has behavior that it doesn’t.
Eg if a form input changes, that change triggers an onChange and in a handler function, you can let the change just flow through the data layer (ie through a signal or a store, which is just a hierarchy of signals). This then updates the input, but it already had that value so nothing happens. It’s pretty much the unidirectional loop that React people love to talk about.
- satvikpendem 3y agoSorry, I should have been more clear, I was talking more about Vue and Svelte rather than Solid, which explicitly says they don't have 2-way binding due to learning about how dangerous it is and how React doesn't have it: https://www.solidjs.com/guides/faq#why-can-i-not-just-assign-a-value-to-solids-store-as-i-can-in-vue-svelte-or-mobx-where-is-the-2-way-binding https://www.solidjs.com/guides/faq#why-can-i-not-just-assign...
- preommr 3y agoThese discussions are so tiring. React has as much two way binding as vue - in vue v-model is just syntactic sugar for setting up event listeners and setting the value on an input element. Per the docs [0] <input v-model="searchText" /> Becomes <input :value="searchText" @input="searchText = $event.target.value" /> It's such a small thing that it's crazy it's being discussed this much. [0] https://vuejs.org/guide/components/v-model.html https://vuejs.org/guide/components/v-model.html
- nsonha 3y agoReact has no data binding at all, let alone 2 ways.
- mmmeff 3y agoWhat you’re talking about is unidirectional data binding, and what you’re replying to specifically mentions its failure to scale with complex applications. It’s not the kind of problem you can appreciate when taking any framework for a spin with a form input.
- skrebbel 3y agoNo, what I replied to said that about 2-way data binding. React also (just about) forces you to do unidirectional data flow, just like Solid.