From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Functional components

Functional components

Hi and welcome back. In this video, we'll discuss functional components. Functional components are declared as same as a JavaScript function. It can receive props and returns back JSX. We are going to discuss props in lesson number 3 in more detail. But for now, you can consider props as a parameter to a function. Function components are preferred in modern react applications. As we already discussed in module number 1 that class-based components are obsoleted for now and in future we are just going to use function components in react. That's how a function component looks like. Since we have already created functional components in the previous videos, as we can easily relate to this function component which has a function keyword, function name, it can receive props and returns back JSX. Let's discuss functional component and hooks. Hooks were introduced in React 16.8 versions and onwards. Before that, in the earlier React versions, there were only class-based components. Function…

Contents