React JS Components

  • React components are the basic building blocks of a React application.
  • They work same as JavaScript functions but return HTML.
  • There are two type of react component

  1. Class components : it is used in legacy version of react.  now it is recommended to use functional component with hooks.
  2. Functional Component: A functional component in React is a JavaScript function that returns a React element.

Below index.js file showing both class and functional component. Person is the class component and App is the functional component. The App HTML also embed Person page embed into it.

index.js

Output:

Hello, World!

This is a example of class component in JSX.

My name is Shrikant from Person class component

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top