...

/

React Component Composition

React Component Composition

Learn how React feature allows to compose React components into each other.

We'll cover the following...

Now we’ll discover how to use a React element in the same fashion as an HTML element, with an opening and closing tag:

Press + to interact
const App = () => {
...
return (
<div>
<h1>My Hacker Stories</h1>
<InputWithLabel
id="search"
value={searchTerm}
onInputChange={handleSearch}
>
Search
</InputWithLabel>
...
</div>
);
};

Instead of using the label prop from before, we inserted the text “Search:” between the component’s element’s tags. In the InputWithLabel component, you have ...

Access this course and 1400+ top-rated courses and projects.