DEV Community

Discussion on: 🧐Most Confusing Part Of JavaScript.

 
peerreynders profile image
peerreynders

@lukeshiru I'm not disagreeing with you.


I'm just commenting on the general notion among some React users who claim that React is a technology that is based on the functional paradigm because it makes the "view" a "function" of "state".

It's actually React's component model that makes it popular and it's component instances that make React an object-centric technology.

A function component may just be a function - but that function manages any number of stateful component instances while also rendering their part of the view.

The function's props are dynamic data from the owner component instance of the current component instance being rendered and hooks give the function access to the current component instance's mutable state.

So even when exclusively using function components (with hooks) in React the approach is still object-centric due to the foundation of mutable, stateful component instances (absence of 'this' notwithstanding).


Even back in 2008 Douglas Crockford in "JavaScript the Good Parts" described using object factories (and closures) to get rid of 'this' (OOP with Functions in JavaScript, How to decide between classes v. closures in JavaScript).