๐Ÿ“š Reference


๐Ÿ“œ Chapter


โ€ฃ

โ€ฃ

โ€ฃ

โ€ฃ

Data Fetching


CSR


import { useEffect, useState } from 'react'
import styles from '../styles/Home.module.css'
import axios from 'axios';

export default function Home() {
  const [dateTime, setDateTime] = useState(null);

  useEffect(async () => {
    try {
      const response = await axios.get('<https://worldtimeapi.org/api/ip>');
      setDateTime(response.data.datetime);
    }
    catch (e) {
      console.error(e);
    }
  },[]);

  return (
    <div className={styles.container}>
      {dateTime || "๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ..."}
    </div>
  )
}