import React, { useEffect, useState } from 'react' import Link from 'next/link' import Head from '../components/head' import Nav from '../components/nav' const Home = () => { const [date, setDate] = useState(null); useEffect(() => { async function getDate() { const res = await fetch('/api/date'); const newDate = await res.json(); setDate(newDate); } getDate(); }, []); return (
To get started, edit the pages/index.js
or pages/api/date.js
files, then save to reload.
The date is: {date ? {date.date} : }