@MaeWolff
Posted
Hi, congrats on your project post :) !
I have noted a few points that you could improve:
- Use a solution like
prettier
if you're on vscode to make your code a bit more readable - You could also use the
form
tag to wrap the input and the button of your searchbar so that we can use the tab to do our search. So you could also put the input value into a state using theonChange
event and use it in yourhandleClick
function rather than usinggetElementsByClassName
. - Avoid using
any
type, you can create a related type for Ë‹user`
Marked as helpful
@lorenzoaniel
Posted
@MaeWolff
thanks, i dont know why i didnt do the onchange, I had it for a previous project but I must have tunneled on the idea of sending the request during onClick and so relied on a primative method of using getElementsByClassName. I didn't know you can use the form as more of an accessibility thing for tab, now that i think of it we are sending data so a form makes sense. As for the any type I believe I made a separate file for User type with all of the types for the return data although I did convert it to Partial<> as i didnt need to use all of it, maybe I missed using it for some props or during the initial load on page I will double check.
thanks for the feed back, i greatly appreciate the pointers. If you have any experience with NextJS feel free to give me some tips I am a newbie with it.