![]() |
VOOZH | about |
React allows us to render one component inside another component. It means we can create the parent-child relationship between the 2 or more components. In the ReactJS Components, it is easy to build a complex UI of any application. We can divide the UI of the application into small components and render every component individually on the web page.
To show embed components in one component in React we will create two functional components named child1 and child2 and import them in the App.js directory to render them on the UI.
Step 1: Use this command to create a new react project
npx create-react-app testappStep 2: Move to the testapp project folder from the terminal.
cd testappIt should look like this.
Example: Shows two child components embeded in App.js component.
Steps to Run: To start the react app, run the below command on your terminal and verify that react app is working fine.
npm startOutput: You will see react app is started on localhost:3000 without any difficulty. Here, the App component is a parent component of the child1 and child2 components.