atapas/webapis-playground

[Improvement] replace currenct searchApi method with hook

rzhekova opened this issue · 0 comments

Currently eslint flags a warning on the SearchBox component due to useEffect missing onSearch from its dependency array. When you add it to the array, the search finctionality on the website breaks due to an infinite re-render. Potentially this happens because we end up with a circular new objects creation by triggering the filter array method within SearchBox.

Replacing this function with a hook that gets called in the parent component (App) fixes this issue. I will raise a PR for this.