Part II

Learning ReactJS

Soo let's create our first functional component but,

What is a React Component?

Mainly, it is a building block of ReactJS. The user interface of every application can be broken down into pieces and bits called components. They are reusable bits of code, and they also return HTML. It can also be meant as a custom HTML element that is rendered into the browser using React.

There are mainly two types of ReactJS components.

  • Functional Components
  • Class components

We will mostly use functional components. So the syntax of a functional component is exactly like a function in JavaScript. To create a functional component, we have to create a Javascript file with same name as the functional component and include the component in the root, you may follow the example of App component which will already be given with the files after installation. The component must always start with an uppercase letter.

function FirstComponent() {
  return (
    <div>
      <h1>Hello World</h1>
    </div>
  );
}

export default FirstComponent;

To check the output, you have to run the following command on your terminal.

npm start

Hey! Congratulate yourself for creating your FirstComponent hehe..🥳

Okay Bye then, I'll see you later.

Feel free to suggest any corrections. To know more, refer https://www.geeksforgeeks.org/reactjs-components/