File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/components/SearchForm Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ const SearchForm = (props: Props) => {
36
36
props . search ( category , genre , query ) ;
37
37
} ;
38
38
39
+ const renderDropdownItem = useCallback ( ( item : SearchParam ) => ( { id : item . id , el : item . label } ) , [ ] ) ;
40
+
39
41
return (
40
42
< div className = "search-form" >
41
43
{ ( props . selectedCategory || props . selectedGenre || props . selectedQuery ) && (
@@ -76,15 +78,15 @@ const SearchForm = (props: Props) => {
76
78
< div className = "search-form__field" data-testid = "category-dropdown" >
77
79
< Dropdown < SearchParam >
78
80
items = { props . availableCategories || [ ] }
79
- renderItem = { i => ( { id : i . id , el : i . label } ) }
81
+ renderItem = { renderDropdownItem }
80
82
onSelect = { handleCategorySelected }
81
83
placeholder = "Category"
82
84
/>
83
85
</ div >
84
86
< div className = "search-form__field" data-testid = "genre-dropdown" >
85
87
< Dropdown < SearchParam >
86
88
items = { props . availableGenres || [ ] }
87
- renderItem = { i => ( { id : i . id , el : i . label } ) }
89
+ renderItem = { renderDropdownItem }
88
90
onSelect = { handleGenreSelected }
89
91
placeholder = "Genre"
90
92
/>
@@ -113,4 +115,4 @@ const SearchForm = (props: Props) => {
113
115
114
116
SearchForm . displayName = 'SearchForm' ;
115
117
116
- export default SearchForm ;
118
+ export default React . memo ( SearchForm ) ;
You can’t perform that action at this time.
0 commit comments