“If you think of React as primarily a vdom, you’re probably missing something…”


“If you think of React as primarily a vdom, you’re probably missing something…”

The creator of React said this: https://twitter.com/jordwalke/status/775906762486587393

If you think of React as primarily a vdom, you're probably missing something.

You know how text inputs can be rerendered without messing up selection? Cool, right? React says you should be able to implement <input> too

Or any other component that is allowed to manage state without exposing the details of that state as its API

React should add APIs for dealing with that state in a more functional way, but the important part is that it remain encapsulated

Oh and it's okay to start out thinking of it that way. If that's all you ever need it for that's cool too. But there's more.

I do think of React as primarily a vdom, and am wondering why the internal state thing is not just an obvious carry-over from OOP. The vdom seems primary since it lets us think of components as pure functions whenever possible (huge win). And hidden state inside of them lets us trade explicitness for convenience whenever we find it appropriate to do so.

With that in mind, am I missing something? Is react not primarily a vdom + some OOP stateful bits for convenience?

Submitted September 14, 2016 at 11:05PM by undershirt
via reddit http://ift.tt/2cY5S92