In this third episode, we will discuss about the two type of components in ReactJS - Class components and Functional component and what should we use.
- React class based components were since 2013 and was superior to functional component.
- Functional components were called dumb components, because they were used just for presentational purpose
- Functional components were lacking two important features of class based components ie state and lifecycle methods.
- Class based components created more problems because of the over complicated this keywords and complex lifecycle methods.
- Functional components are more easier to understand, because of the lack of this of javascript.
- The hook useEffect replaces most Lifecycle method and is extremely easy to use.
- If you or your company is starting a new project, go with hook based functional component, as most third party popular modules like react-router have hook counterpart and slowly moving toward hook.
- If you are in a 2-3 year old project then have to work with classes, so it's a must have knowledge.
πββοΈ Connect with me
π¨ LinkedIn - https://www.linkedin.com/in/nabendu-biswas/
π¨ twitter - https://twitter.com/nabendu82
π¨ Facebook - https://www.facebook.com/nabendu.biswas.77
π¨Site - https://thewebdev.tech
π¨ Instagram- https://www.instagram.com/nabendu.codes
π¨ Linktree - https://linktr.ee/nabendu.biswas
π΄ Exclusive Facebook Group for developers https://www.facebook.com/groups/thewebdev4u
π΄ Exclusive Telegram Group for developers https://t.me/joinchat/H6llKYR0a05hNmI1