Rendering the Component
We have successfully made the components, but in order to use them we need to render them. one can first export their components and can use them anywhere in the ReactDOM.render method after importing them.
Somewhere in your project in ReactDOM.render()
ReactDOM.render(
<React.StrictMode>
<Greet name="gfg " />
</React.StrictMode>,
document.getElementById('root')
);
How to create components in ReactJS ?
Components in React JS is are the core of building React applications. Components are the building blocks that contains UI elements and logic, making the development process easier and reusable. In this article we will see how we can create components in React JS.
Table of Content
- React Functional Components
- React Class-based Components
- Rendering the Component