Open In App

ReactJS Components Complete Reference

Components are bits of code that are freelance and reusable. They serve a similar purpose as JavaScript functions. However, work isolation and returns HTML via a render function.

A Component is one of the core building blocks of React. In other words, we can say that every application you will develop in React will be made up of pieces called components. Components make the task of building UIs much easier. You can see a UI broken down into multiple individual pieces called components and work on them independently and merge them all in a parent component which will be your final UI.



Components in React basically return a piece of JSX code which tells what should be rendered on the screen. In React, we mainly have two types of components:




function Democomponent()
  
{
  
   return <h1>Welcome Message!</h1>;
  
}

 
 



 

Below example shows a valid class-based component in React:

 




class Democomponent extends React.Component
  
{
  
   render(){
  
         return <h1>Welcome Message!</h1>;
  
   }
  
}

Complete Reference:


Article Tags :