Teaching Class Components Over Functional Components

Hi,

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:
FUNCTION COMPONENTS

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