import axios from 'axios' import Link from 'next/link' import React, { useEffect, useState } from 'react' import { format } from 'date-fns' import { IoCalendarOutline } from 'react-icons/io5' const WhatsNewMonthlyUpdate = () => { const [data, setData] = useState([]) useEffect(() => { const fetchData = async () => { try { let cachedData = localStorage.getItem('monthlyReleaseData') if (cachedData) { // If cached data is available, parse and set it setData(JSON.parse(cachedData)) } else { const response = await axios.get( 'https://cmswp.gwkbali.com/wp-json/wp/v2/monthly-release/', { // headers: { // 'Cache-Control': 'public, max-age=3600, must-revalidate', // }, } ) setData(response.data) // Cache the fetched data in local storage localStorage.setItem( 'monthlyReleaseData', JSON.stringify(response.data) ) } } catch (error) { console.error('Error fetching data:', error) } } fetchData() }, []) return (