cookiePart Function

Creates an instance of CookiePart, allowing interaction with a specific key-value pair stored in the browser’s cookie. You can also provide optional removeParams for managing cookie removal

@template T extends CookieData<any> = CookieData<string | undefined>
Represents an object that includes both the value and parameters for the cookie.
Defaults to CookieData<string | undefined>

@param key: string
The key used to access the value in the browser cookie

@param removeParams?: CookieParams
Optional parameters for managing cookie removal

@returns CookiePart<T>

See also: CookieData, CookieParams

API

function cookiePart<T extends CookieData<any> = CookieData<string | undefined>>(
  key: string,
  removeParams?: CookieParams,
): CookiePart<T>;

Example

import {cookiePart} from '@bitfiber/rx';
 
const ckPart = cookiePart('key');