Cookie component helps you build your own custom cookie and session implementations. All Hydrogen session storage mechanisms use the same configuration options as
Example codeAnchor link to section titled "Example code"
Cookie optionsAnchor link to section titled "Cookie options"
The following table describes the options for how the cookie is persisted within the browser. The properties are derived from the cookie specification:
||A date on which the cookie will expire. If the date is in the past, then the browser will remove the cookie.|
||The number of seconds until the cookie expires.
||Whether to secure the cookie so that the browser only sends the cookie over HTTPS. Some browsers don't work with secure cookies on localhost.|
||Declares that the cookie should be restricted to a first-party or same-site context.|
||Tells the browser that the cookie should only be sent to the server if it's within the defined path.|
||Secures the cookie so that it's only used on specific domains.|
Component typeAnchor link to section titled "Component type"
Cookie component is a server component. For more information about component types, refer to React Server Components.