Skip to content

Instantly share code, notes, and snippets.

@yoovanr
Created June 30, 2021 11:57
Show Gist options
  • Save yoovanr/cba748ea0bfc609055a5fb781e64425b to your computer and use it in GitHub Desktop.
Save yoovanr/cba748ea0bfc609055a5fb781e64425b to your computer and use it in GitHub Desktop.
// pages/index.js
import React, { useEffect } from 'react'
import CookiesUtils from '../utils/cookies'
const HomePage = () => {
useEffect(() => {
CookiesUtils.getItem('server-side-cookies') // Output: Aloha from server side cookies!
CookiesUtils.setItem('client-side-cookies', 'Aloha from client side cookies!')
CookiesUtils.getItem('client-side-cookies') // Output: Aloha from client side cookies!
}, [])
// ...
}
export default HomePage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment