Teaching Class Components Over Functional Components


I was having trouble understanding functional components from another course I’m taking and passing around props eventually got quite confusing so I came to Codecademy, hoping to get a different perspective but I noticed that the React track mainly teaches class and interacting with class components. I was under the impression that class components are not encouraged by the React team. So now I’m even more confused if my understanding is incorrect, if I should work on the Codecademy’s class components track, or if I should find other resources to solidify my functional component knowledge. Any advice? Thanks!

do you have a source for this?

I think functional components are easier to start with (for learning purpose), but classes are absolutely preferred to provide more structure and hierarchy once your application starts to grow

React does a lot under the hood, being able to see through this abstraction layer absolutely helps. But this is a very difficult skill. Having a good understanding of JavaScript and the DOM helps, because it helps you understand why the React devs made certain decisions

In the section named " Classes confuse both people and machines."

This update of react was released after the codecademy course

The hooks seem sensible indeed, but where not available at the time.

Hmm… In that case, in your opinion, is learning class components still a priority at this stage or should effort be directed towards functional components instead? It seems to be a waste to not take advantage of a lot of the projects & resources under the React track, but class syntax have to be used in order to proceed with the course and I just find myself getting more confused between the two.

In the long run, you need to understand different concepts so you can decide what is the best implementation.

for now? Maybe focus one approach so you can become better/deepen your understanding.

1 Like

Thanks, I appreciate the feedback, it’s very helpful.

While React didn’t announce deprecation of class components, it is my impression, too, that using functional components is more up to date, indeed. Because

  1. They were introduced after the class components
  2. Most developers seem to prefer functional components since at least from my impression most articles and packages are function based.

As @stetim94 wrote the course has been developed prior to the release of function components. Yet there is an update for function components in the front end path:

I also prefer function components. They are more concise and the possibility of adding custom hooks is very convenient.

Yet I found the react course on Codecademy very useful. Most of the concepts are the same in class and function components. So learning class components prepares you for function components. You will see some react code written as class components online, so it is helpful to be able to read and understand it.

1 Like

Thanks for linking to the updated section. I scoured through but didn’t find it myself, so I will be sure to check it out. I think I will go back to learning class components at some point, once I have a more solid base in functional. Thanks again for the tip.

1 Like

I think react lessons needs to be update because we learn all the logic of components with using class components and then we learn functional components… yes some old projects build class components and its ok to learn but it shouldn’t be like that… we need to learn all props, events, methods and the other logics with using Functional Component otherwise its going to be confusing and kinda waste of time

I think it’s important to have a good understanding of both class and function-based components to get good at react. But yes, if you can use functional components that would be your go-to choice 99% of the time, although in some cases I would still prefer to use class components in a big project.

It would be really nice for Codecademy to update this course to teach all the concepts using functional components and maybe add class components at the end to show the difference.