Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async in useeffect

  useEffect(() => {
    (async () => {
      const products = await api.index()
      setFilteredProducts(products)
      setProducts(products)
    })()
  }, [])

Source by dev.to #
 
PREVIOUS NEXT
Tagged: #async #useeffect
ADD COMMENT
Topic
Name
5+8 =