score:4

Accepted answer
const Tasks = () => {
  const [tasks, setTasks] = useState([]);
  useEffect(() => {
    axios.get('/tasks').then(response => setTasks(response.data));        
  },[]);

  return (
      <ul>
        {tasks.map(() => <li>dd</li>)}
      </ul>
  );
};

score:2

  useEffect(() => {
    axios.get('/tasks').then(response => setTasks(response.data));
  },[])

  return (tasks.length && <ul>{tasks.map(/*...*/)}</ul>)

Related Query

More Query from same tag