React Hooks - useEffect

import React, { useEffect } from 'react'

export default function App() {
  const [date, setData] = useState([])

  useEffect(() => {
    async function fetchData() {
      // magic
    }

    fetchData()
  }, []) // [] will make it run only once
}

This is wrong

  useEffect(async () => {
    // magic
  },

This is right

useEffect(() => {
  async function fetchData() {
    // magic
  }

  fetchData()
}, [])

Please note that this site and the posts on it are, and will always be, a work in progress. If i waited for perfection, i’d never get anything done.