btw can we also show a spinner or loading text while the calculations are happening in the background because UX wise i didn't feel right because as a user i did not get any feedback after typing on the input box
Yes for sure, I've added it to the demo. Basically you just need to set and remove the searching element - you could even have "real" progress I guess. I changed the app to look like this:
exportdefaultfunctionApp(){const[value,setValue]=React.useState("")const[list,setList]=React.useState([])const[searching,setSearching]=React.useState(false)React.useEffect(()=>{setSearching(true)find(value,results=>{setList(results)setSearching(false)})},[value])return(<divclassName="App"><h1><ahref="http://js-coroutines.com">js-coroutines</a> and
1,000,000 entries <CircularProgresscolor="secondary"/></h1><divstyle={{display:"flex",alignItems:"center",width:"100%"}}><divstyle={{flexGrow:1}}/><inputstyle={{marginRight:8}}value={value}placeholder="type a search"onChange={({target:{value}})=>setValue(value)}/><divstyle={{opacity:searching?1:0}}><CircularProgresssize="1.2em"color="primary"/><emstyle={{marginLeft:8,fontSize:"80%",color:"#ccc"}}>
Searching...
</em></div><divstyle={{flexGrow:1}}/></div>{!!list.length&&<h3>Recommendations</h3>}<ul>{list.map((item,index)=>{return<likey={index}>{item}</li>})}</ul></div>)}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is really awesome mike. great work.
btw can we also show a spinner or loading text while the calculations are happening in the background because UX wise i didn't feel right because as a user i did not get any feedback after typing on the input box
Yes for sure, I've added it to the demo. Basically you just need to set and remove the searching element - you could even have "real" progress I guess. I changed the app to look like this: