Introduction
In this article, we will learn to create a new ReactJs project using npm new command, After that, we will explain how to create Types of React Components in Visual Studio code.
Step 1
Create a React project setup using the below commands or however you create your React app
ng new sample-project

Step 2
What Are React Components?
React components are the core building blocks of any react application. It is reusable and works independently. Components serve the same purpose as JavaScript functions, but work individually to return JSX code as elements for our UI
Types of React Components
- Functional Components
- Class Components
React Functional Components - An Introduction
React functional components are just normal JavaScript functions; we can create them using specific function keywords. Most developers create functional components using the Arrow function. The functional component’s primary purpose is to render the view and the data to the browser.
Below is the example of a react functional component props as an argument and returns the support in the valid JSX form.
import React from "react";
function Header() {
return (
<div className="header">
<div className="container">
<div className="logo">LOGO</div>
<div className="navbar">
<ul>
<li>Dashboard</li>
<li>About</li>
<li>Login</li>
</ul>
</div>
</div>
</div>
);
}
export default Header;
React Arrow Function Component
Arrow functions offer a compressed and short version of a function expression and need fewer keystrokes than regular JavaScript functions from the developer and can be used as a simpler alternative to functions within class components and functional components and event handlers in React.
Below is an example for react functional component with arrow function
import React from "react";
const Header = () => {
return <div className="header">
<div className="container">
<div className="logo">LOGO</div>
<div className="navbar">
<ul>
<li>Dashboard</li>
<li>About</li>
<li>Login</li>
</ul>
</div>
</div>
</div>
}
export default Header;
Step 3
Create Project Folder structure,




Join the conversation! Your thoughts help the community grow.