import { setEntreprise } from 'Actions/existingCompanyActions' import { React, T } from 'Components' import CompanyDetails from 'Components/CompanyDetails' import { useCallback, useMemo, useState } from 'react' import { useDispatch } from 'react-redux' // $FlowFixMe import 'react-select/dist/react-select.css' import { searchDenominationOrSiren } from '../api/sirene' import { debounce } from '../utils' export default function Search() { const [searchResults, setSearchResults] = useState() const [isLoading, setLoadingState] = useState(false) const handleSearch = useCallback( function(value) { searchDenominationOrSiren(value).then(results => { setLoadingState(false) setSearchResults(results) }) }, [setSearchResults, setLoadingState] ) const debouncedHandleSearch = useMemo(() => debounce(300, handleSearch), [ handleSearch ]) const dispatch = useDispatch() return ( <>
Aucun résultat
} {searchResults && searchResults.map(({ siren, denomination }) => ( ))} > ) }