import './App.css'; import React, { useState, useEffect } from 'react'; function App() { const [joke, setJoke] = useState(null); useEffect(() => { fetch('/api/badjokes') .then((response) => response.json()) .then((data) => { console.log(data.joke); setJoke(data.joke); }) .catch((err) => { console.log(err.message); }); }, []); return (
Here is your joke: {joke ? {joke} : Loading...}