# How can I use Astro.cookies in my Preact component? I want to be able to use Astro.cookies in my Preact component, it was working before in dev testing but in production, it doesn't work I tried to do import {AstroCookies} from "astro" and that seemed to work but it didn't after a while Code I attempted to use to set the cookie: ``` const data = response.json() const sessionId = data.sessionId const maxAge = data.maxAge try { Astro.cookies.set('sessionId', sessionId, { httpOnly: true, maxAge: maxAge }) } catch (e) { console.error(e) } ``` ## Answer basically you'll need to call Astro.cookies in a .astro file and pass it into your Preact component as a prop.