Let's take care of an easy fix first.
Right now, if we delete everything inside that input, we get a nasty error like this one right here.
So this is because we are doing a search with an empty string.
You might recall that we spoke about this a little bit ago and we ended up with a default search term
right here that we made use of a default search term just to make sure that we wouldn't do a search
without any content inside of it or no search term.
So we're going to restore that same kind of fix we put in previously.
We'll say that we only want to run a search if there is a term.
So if term is empty string, don't do a search at all.
Otherwise, if we've got some term defined, go ahead and run the search.
Let's try to save this now.
Now, if I delete everything.
The page just stays the same.
And it's only when I start to type.
That I start to do some more searches.
That's an easy fix.
But now let's make sure that we take care of not making quite so many requests off to that API in just
a moment.