async function inside use effect code example
Example 1: async useeffect
useEffect(() => {
(async function anyNameFunction() {await loadContent();})();
}, []);
Example 2: async in useeffect
useEffect(() => {
(async () => {
const products = await api.index()
setFilteredProducts(products)
setProducts(products)
})()
}, [])