Re:How Does React Tell a Class from a Function?
by k__ on Monday December 03, 2018 @08:25AM
(#18588549)
React started with class components, because of state, I guess.
Later they added function components because they are more concise and tell readers that this component is a simple mapping from props to virtual DOM elements.
With hooks, a recent addition to React, they seem to move away from class components. Hooks enable you to use state and do things when a component is mounted in the DOM or removed from it inside of function components.
Later they added function components because they are more concise and tell readers that this component is a simple mapping from props to virtual DOM elements.
With hooks, a recent addition to React, they seem to move away from class components. Hooks enable you to use state and do things when a component is mounted in the DOM or removed from it inside of function components.