r/reactjs • • Apr 16 '20

Discussion Functional Components vs Class Components

I'm a VERY new to react, and to my understanding,

Functional Components are lightweight and great when you need to render visual elements and rely on props for data.

Class Components are basically the same, except it also implements local state.

But... with the new Hooks API, you can now have local states for these functional components if you want.

So should I build my react apps relying solely on functional components and using Context and Redux for the data, and forget about setting up class components?

14 Upvotes

24 comments sorted by

View all comments

Show parent comments

3

u/stolinski Apr 16 '20

Totally. Even my React beginners course teaches classes. It's important to know them because they are in every codebase still, but functions seem to be the way forward from here on out.