Skip to content

Instantly share code, notes, and snippets.

@giovannicocco
Last active September 20, 2023 10:14
Show Gist options
  • Save giovannicocco/08f76937381567999436a9372a6266d8 to your computer and use it in GitHub Desktop.
Save giovannicocco/08f76937381567999436a9372a6266d8 to your computer and use it in GitHub Desktop.
Get Cookies Values and Display It in Framer.com
// Create a TSX file of type override by clicking on Assets -> Code and clicking on (+);
//Copy, paste the code below and save;
//Go to Pages, select the page and select the paragraph or heading you want to display the cookie value;
//In the right side menu go to Code Overrides and click (+), select the Cookies file;
//In Overrides select withCookies;
//Publish your page and you're done.
// In this example I am getting the value from _fbp cookie
import type { ComponentType } from "react"
import Cookies from "cookiejs"
export function withCookie(Component): ComponentType {
return (props) => {
const cookieValue: string = Cookies.get("_fbp") as string
return <Component {...props} text={cookieValue} />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment