Despite what some people say, I think it’s fair to call React “object-oriented”. From Why React? on the React site:
React is all about building reusable components. In fact, with React the only thing you do is build components. Since they’re so encapsulated, components make code reuse, testing, and separation of concerns easy.
To me, the big idea of React is that you do not manipulate the object graph directly. In most OO toolkits, you build a tree of view components in an imperative manner, and manually update the tree as your UI moves through different states. React is much more declarative: each component’s
render() method returns a value describing its desired subtrees. Internally, React reconciles the current tree with the desired one — instantiating, modifying, or destroying actual component instances as necessary. This also has the effect of discouraging aliasing (multiple references to the same object), which can be a big source of problems in object-oriented programs.1
Of course, there’s a lot more to React than this, but this feels like the big idea to me. Like most good ideas, this is probably not new, but I can’t remember having seen it before. I think it’s applicable to more than just UIs, so I’m curious to see if we’ll see this pattern start to pop up in other domains.