Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what difference between react func and class components

And so to answer our question before, you should use functional components if you are writing a presentational component which doesn’t have its own state or needs to access a lifecycle hook. Otherwise you can stick to class components or take a look into the library recompose which allows you to write functional components and enhance them with a state or lifecycle hooks with HOCs!
Source: https://djoech.medium.com/functional-vs-class-components-in-react-231e3fbd7108
 
PREVIOUS NEXT
Tagged: #difference #react #func #class #components
ADD COMMENT
Topic
Name
4+2 =