Autocomplete Input Bar

How to make this in MERN stack ? Does this use Google API ( which I don't want cause it ask for billing after certain months ). Or is there any other alternative present
No description
8 Replies
glutonium
glutonium14mo ago
i personally couldn't any alternative way wherever i search, only the google auto complete shows up
Jochem
Jochem14mo ago
find a list of cities somewhere, store it in your database, then write an endpoint in Express that takes in a string and returns the first five search results. In react, create the text field and the dropdown list (probably an <input> and a <ul>), then onkeypress in the text field, send a request to the express endpoint and render the result in the list. You probably want to debounce inputs, so always wait say 100ms before sending the next request, and cancelling that wait on subsequent presses and replacing it with a new timeout also, MERN is a bit of a meme stack. A lot of youtubers love to make videos about it, but it's rarely used in the real world afaik
icebyte
icebyte14mo ago
Which one is used in the real world then?
Jochem
Jochem14mo ago
usually at the very least something with an RDBMS over Mongo if you're learning to get a job, look at job listings around you and learn what they use the most. Don't just default to MERN without a good reason, it's not a good default stack to learn
Leo_
Leo_OP14mo ago
thats what I am doing, learning MERN cause its what other people I see are doing...
Jochem
Jochem14mo ago
if that's what's popular with companies in your area, then it's a good move to learn it
Leo_
Leo_OP14mo ago
how did you learn all this, I am beginner and I am facing problems in writing the code on my own, if I want to build something out of scratch no, i have not reasearched about it
Jochem
Jochem14mo ago
if you're just learning MERN because everyone else is learning MERN, you may want to do that research it's a question of breaking it down in to smaller and smaller steps, until the steps are something you know how to do. That's really all that coding is. I learned it by needing to build it myself over 15 years ago now
Want results from more Discord servers?
Add your server