Submitted
React + Styled Components + Debounce search
- HTML
- CSS
- JS
- API
What are you most proud of, and what would you do differently next time?
This project is currently the best I made and the most proud of. I really loved coding this dictionary.
What challenges did you encounter, and how did you overcome them?
Astonishment, a challenges I encountered was to set an error on the input when this one is empty. I used an realtime api call with a debounce and you don't need to press enter or click to submit your word. So I can't use the onSubmit function to prevent an empty input. Instead, I choose to made a verification into the handleChange function.
What specific areas of your project would you like help with?
I used the handleChange function to check if the input is empty or not, this is the function :
function handleChange() {
if (!event.target.value) {
setInputError('Whoops, can’t be empty…');
} else {
setInputError('');
}
setWord(event.target.value);
}
I think there is a better way to do this. Actually, the network request will be made, even if the input is empty.