Hacker News new | ask | show | jobs
by invaliduser 488 days ago
Not primarily, as primarily it was just "we're the V in MVC", and people were using classes. The hooks came when the react team got on the "functional programming" wagon, and suddenly everything was about immutability, side effects, etc. and very little about giving control to the developers on their components life cycle.
1 comments

React was literally first created in ML out of the author's dislike of MVC, who preferred functional programming and immutability[0]. For a long time, react aspired for its future to be in ReasonML.

Hooks came as no surprise to anyone who paid attention, as the recommended way to write components since at least 2016 was in the stateless functional style whenever possible, and many of us used recompose[1] to simulate hooks long before their introduction.

[0] https://github.com/reactiflux/q-and-a/blob/master/jordan-wal...

[1] https://github.com/acdlite/recompose

Maybe I was not paying attention, this is of course a possibility, but until at least early 2019 the react website's main page was only mentioning the class-based "stateful component" as the way to write components.

https://web.archive.org/web/20190105060636/https://reactjs.o...

Although they were mentioning function components at the time in the documentation, I can't say how mainstream that was. Hooks were introduced in Feb. 2019.