DEV Community


Discussion on: ReactJS Class Components

guidovizoso profile image
Guido Vizoso

Let me check if I got your answer right: You are asking if you should make every component in React a class, right?
If that's the question, I don't think that'll be necessary. React class components are powerful but slower in performance compared with functional components. What I like to do is creating all presentational (ui) components as functional components and all the container components a class component. With this structure I have a well defined state with well declared methods in a class component that pass the props to their presentational childrens.

Tip: If you're using Redux a very useful middleware for API calls is Redux-Saga. It allows you to make asynchronous API calls with ease.

Hope this helps!