Prevent React error for close

feature/default_network_editable
David Walsh 4 years ago
parent 14fff6dcf2
commit f4e5eeca18
  1. 7
      ui/app/pages/swaps/dropdown-search-list/dropdown-search-list.js

@ -29,15 +29,16 @@ export default function DropdownSearchList ({
const t = useContext(I18nContext)
const [isOpen, setIsOpen] = useState(false)
const [selectedItem, setSelectedItem] = useState(startingItem)
const close = () => {
const close = useCallback(() => {
setIsOpen(false)
onClose && onClose()
}
}, [onClose])
const onClickItem = useCallback((item) => {
onSelect && onSelect(item)
setSelectedItem(item)
close()
}, [onSelect])
}, [onSelect, close])
const onClickSelector = useCallback(() => {
if (!isOpen) {

Loading…
Cancel
Save