How to make a simple search bar in React (from scratch) | Fast tutorial

Опубликовано: 29 Июнь 2021
на канале: Carmelle Codes
42,204
518

In this tutorial, we’ll go over a common frontend problem: how to make a search bar from scratch. We’ll start out with an input and some data that I grabbed from the Spotify Web API, in this case an album. After listing out our data, we’ll create a getFilteredItems helper function that will run multiple times in the render() function. This is an adequate solution for small lists but if your list is greater than 100 items, you might want to search for a more optimal solution like a debounce - let me know in the comments if this is something you’re looking for, and thank you for supporting this channel!

As an aside, this is a pretty common interview problem for frontend jobs, using Javascript functions to search through some object/array.

Link to code:
https://codesandbox.io/s/musing-khora...