OOP is not a silver bullet but for some classes of problems it's the best tool available.
That's the reason why all good rich GUI frameworks are OOP-based, including HTML DOM we use on the web. GPU APIs, OS kernel APIs are OOP-based as well.
Yeah, that's a fair point. React isn't purely functional, but in practice I'd say it still leans heavily toward a functional approach
You're encouraged to keep state only in top-level components, or in a functional-style state management library like Redux, and pass the data as props/parameters to pure components that are just functions. There's a huge emphasis on immutable data, and composing your various components/functions, passing them as props, etc.
The fact that React switched to using classes makes it seem less functional than it is, and honestly I'm not entirely sure why they decided to do so.
Anyways, you're not wrong, but the point I was trying to make is that React is definitely much more functional than other/older approaches to GUIs, and is popular in (large?) part because of that difference in approach.
> Doesn't state grow unmanageably large for complex GUIs?
Yes, and there are various ways to make this less of a problem. Still, React generally favors explicitly passing props down the component hierarchy, keeping the actual UI bits pure functions and composing them in various ways that is typical of FP.
Perhaps I should've specified that React, as a very popular 'GUI' library, is much more functional than many of the very popular libraries that came before it.
Anyways, my point was not that it's the first of its kind, or 'fully' FP, but rather that it's an example of how FP-style UI libraries can be a good solution, and even be popular because they're less OO in nature.
> it's an example of how FP-style UI libraries can be a good solution
On the lower level, FP approach indeed sometimes causes much cleaner architecture, even for GUI code.
My point is, there’s no good alternatives at higher levels, where you want to build complex systems by combining components developed by different people/companies.
> and even be popular because they're less OO in nature.
That’s debatable. I don’t think the main reasons why React is popular are technical ones. Facebook is popular, and half year ago it’s market cap exceeded $600B. It’s $392B now but still it’s a huge company with 2.2B monthly active users. Many people want to achieve such success and view their technology as a silver bullet.
P.S. I’d like to add that OOP and FP are almost completely orthogonal. Here’s a good article about OOP in FP languages: https://medium.com/@gaperton/let-me-start-from-the-less-obvi... And many traditionally OOP languages adopted a lot of FP stuff: C#, JS, to lesser extent even C++ have now a lot to offer for functional-style programming.
That's the reason why all good rich GUI frameworks are OOP-based, including HTML DOM we use on the web. GPU APIs, OS kernel APIs are OOP-based as well.