...

/

Reusable React Component

Reusable React Component

Learn to reuse a react component.

We'll cover the following...

Have a closer look at the Search component. The label element has the text "Search: "; the id/htmlFor attributes have the search identifier; the value is called search; and the callback handler is called onSearch. The component is very much tied to the search feature, which makes it less reusable for the rest of the application and non search-related tasks. It also risks introducing bugs if two of these Search components are rendered side by side, because the htmlFor/id ...