React Weather API check if user typed a wrong input text

Greetings all! New on the forum, have been doing a simple Weather API app and it’s all working good and all, for my first time working with APIs, but i’ve encountered a problem, that i’m not sure how to fix.
Basically user enters a city to get the weather. Like London or london, but what if he mistypes? on my local host it stops the program, but on codepen, it just doesnt do anything. Is there any way to put a check on the message, to give out some error message.

My idea was checking if a certain City exists in the API, if it doesnt, send the error message. But i’m not sure how to implement it in simple way which im sure exists.
Can’t wrap my head around it…

Here is my code

Thanks in advance