Adding JS into TSX file
Unanswered
Barbary Lion posted this in #help-forum
Barbary LionOP
I have a page that needs to write a cookie. Since it's in /pages/, it can't use cookies from next/headers (needs to be in a server action). Instead, I'll just use document.cookie. How do I do that since my page is TSX instead of JS?
4 Replies
Persian
@Barbary Lion HI
Create a new file in your project source directory and named it like global.d.ts
and you can define an interface that extnds the Document interface
Barbary LionOP
Thanks, I spent a while reading about this and understanding. Wouldn't I have to basically re-build my own router logic if I do that, since I only want to do cookie-setting for a single page?