Hi guys!
In this post, we will learn how to create a fully functional search bar in React JS. We will start by setting up some sample content and ...
For further actions, you may consider blocking this person and/or reporting abuse
Very helpful article. Many thanks
Thank you for this information. 👏.
But would the List component be able to import data from ListData.JSON file because you did not export data from the json file.
Yes it would
since it is JSON data, you can simply import it as 'data'
you can think of the data file as simply an array
Ahh nice one, thank you 🙏
This is Nice But When your search query exceeds one word or more .. it fails badly. Here Because the List items are single word and a single word query makes sense but in real-world applications where the things you were searching in will be more than one words so does your query
One Should use a better approach to handle it
That's a great point. I completely overlooked that while writing this. Often times, real time searches work perfectly using only a few letters. But yeah, a better approach for real world applications does make more sense. Thanks for the comment!
Nice post
thanks :)
Thanks it was a great help
What if no search results? How can we display a 'No results found' error?
We can check the length of the filteredData array. If it is less than 1 then no results.
sda