useCookie icon indicating copy to clipboard operation
useCookie copied to clipboard

Remove cookie

Open Odonno opened this issue 4 years ago • 2 comments

There are functions to get/set cookies but none to remove an existing cookie.

Odonno avatar May 26 '21 15:05 Odonno

@Odonno this seems reasonable since there are already exported functions for get/set. Feel free to open a PR. Otherwise, I'll see if I can get around to adding this in the next couple weeks

tylerwolff avatar Jun 09 '21 01:06 tylerwolff

I managed to do it this way:

setCookie(COOKIE_KEY, "", { days: 0 });

I don't know if it's the fastest/best way but that could be easy to create a removeCookie function from that.

Odonno avatar Jun 09 '21 07:06 Odonno