The CookieStore interface of the Cookie Store API provides methods for getting and setting cookies asynchronously from either a page or a service worker.
CookieStore
This component is a simple wrapper around this native Web API.
Note: older browsers might not support this API, be sure to check the compatibility here.