contexts/LogContext.js - logs

    const [logs, setLogs] = useState([
      {
        id: uuidv4(),
        title: 'Log 03',
        body: 'Log 03',
        date: new Date().toISOString(),
      },
      {
        id: uuidv4(),
        title: 'Log 02',
        body: 'Log 02',
        date: new Date(Date.now() - 1000 * 60 * 3).toISOString(),
      },
      {
        id: uuidv4(),
        title: 'Log 01',
        body: 'Log 01',
        date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 3).toISOString(),
      },
    ]);

    ▲ 그림 6-12 date-fns를 사용한 날짜 포맷팅

    각 항목들의 날짜가 잘 나타났나요?

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.