From the course: React.js: Building an Interface

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating a sub-component Hooks

Creating a sub-component Hooks - React.js Tutorial

From the course: React.js: Building an Interface

Start my 1-month free trial

Creating a sub-component Hooks

- [Tutor] So it's time for us to create another component. I'd like to create the component that has the information for the dropdown when we click right here. Now I could do that in a separate file like I've done this search AS component but it's really a component that's not going to be used anywhere else and it's really part of this search function. I could optionally just create some additional code right here but this is going to be so much code that I like to put it in a separate component by itself. So I'm going to create a const here and I'll call this drop down and I'll use the same function notation with arrow functions. And I have the cool font that lets me use ligatures in VS code so my arrow functions look pretty awesome. And then we're going to need a return statement with some additional HTML. So I put that on this page for you. Let's go ahead and grab this from here. Now we'll go ahead and paste that.…

Contents