JSFiddle - React, Tailwind, and code Playground

JavaScript

function WhatToDo(){
  fetch('https://www.boredapi.com/api/activity')
  	.then((response) => response.json())
  	.then((data) => console.log(data))
    .catch((error) => console.log(error));
}

WhatToDo();

async function WhatToDoAsync() {
  try {
    const response = await fetch('https://www.boredapi.com/api/activity');
    const data = await response.json();
    console.log(data);
  }
  catch(error) {
  	console.log(error);
  }
}

WhatToDoAsync();