Now let's put in a default search term.
Of redress.
And then pass in the.
This state search term.
To fetch products at Componentdidmount.
And then.
Pass into variables here.
Dollar sign.
I also need to add it to the arguments of fetch products here.
So search term.
And then have it inside here.
Search term.
So now we start up the query again just with our state instead.
And now we need to add in the input type text.
Input type text.
Value we can set to this state.
Search term.
We also need to write a onchange function for this.
So this handle search term change.
And in the tag.
So let's write the handle search term change.
Again taking in the event.
And we'll set the state.
Of search term.
To be equal to event target value.
Now also remember to bind it because we're using this inside it, this handle amount change.
Sorry.
Uh, this handle.
Search.
Change.
Yeah.
This handle search term change.
Oops.
Dot bind pass in this Now it's binding this so we can use this set state inside it.
Now, let's see.
So it starts out with red dress and we can try and change it to blue dress.
Then let's try and make the call.
And it looks like it is not passing in the correct search term because they don't look like dresses,
these ones.
I think this is just a default search result it's giving us.
And let's see.
Let's see.
Yeah, of course.
It's because inside of our handle submit function, we need to also pass into this state of search term.
So now it should be working fine.
Let's search for.
Blue shorts.
And there we go.
We get some nice uh oh.
I don't know if that's shorts, but we get some results.
Now let's try and change some things up and we can search for shoes.
And we get lots of lots of shoes.
So people.
That is how.
You reverse engineer a site and find a API and also how you build a backend that is taking advantage
of this API.
And again, how you can build a front end application that can display this.
These this result.
And.
Totally avoiding writing any kind of scraper for your web scraping.
Basically, you avoid writing any kind of web scraping, so it's going to save you a lot of time.
I hope you got something out of this tutorial and I'll see you next time and any questions you have,
feel free to message me.