import { setEntreprise } from 'Actions/existingCompanyActions' import CompanyDetails from 'Components/CompanyDetails' import React, { useCallback, useMemo, useState } from 'react' import { Trans } from 'react-i18next' import { useDispatch } from 'react-redux' import { Etablissement, searchDenominationOrSiren } from '../api/sirene' import { debounce } from '../utils' export default function Search() { const [searchResults, setSearchResults] = useState | null>() 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 ( <>

Retrouver mon entreprise

Grâce à la base SIREN, les données publiques sur votre entreprise seront automatiquement disponibles pour la suite du parcours sur le site.


{ if (e.target.value.length < 2) { setSearchResults(undefined) return } setLoadingState(true) debouncedHandleSearch(e.target.value) }} /> {!isLoading && searchResults === null && (

Aucun résultat

)} {searchResults && searchResults.map(({ siren, denomination }) => ( ))} ) }