react-cookie

  • Version 4.1.1
  • Published
  • 95.7 kB
  • 3 dependencies
  • MIT license

Install

npm i react-cookie
yarn add react-cookie
pnpm add react-cookie

Overview

Universal cookies for React

Index

Functions

function useCookies

useCookies: <T extends string, U = { [K in T]?: any }>(
dependencies?: T[]
) => [
U,
(name: T, value: Cookie, options?: CookieSetOptions) => void,
(name: T, options?: CookieSetOptions) => void
];

    function withCookies

    withCookies: <T extends ReactCookieProps>(
    WrappedComponent: React.ComponentType<T>
    ) => React.ComponentType<Omit<T, keyof ReactCookieProps>>;

      Classes

      class CookiesProvider

      class CookiesProvider extends React.Component<ReactCookieProps, any> {}

        constructor

        constructor(props: ReactCookieProps);

          property cookies

          cookies: Cookies;

            method render

            render: () => JSX.Element;

              Type Aliases

              type ReactCookieProps

              type ReactCookieProps = {
              cookies?: Cookies;
              allCookies?: {
              [name: string]: Cookie;
              };
              children?: any;
              ref?: React.RefObject<{}>;
              };

                Package Files (5)

                Dependencies (3)

                Dev Dependencies (6)

                Peer Dependencies (1)

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-cookie.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-cookie)
                • HTML
                  <a href="https://www.jsdocs.io/package/react-cookie"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>