RE

React Cookie

react-cookie

Universal cookies for React

Utilities
universal
isomophic
cookie
react
react-cookie
Utilities
javascript
npm
frontend
open source
Stars
215
Weekly
1.0M
Open issues
4
Bundle
~25 kB

Installation

npm install react-cookie

Code example

import { useCookie } from "react-cookie";

export function Example() {
  const value = useCookie();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by Benoit Tremblay
  • 1.0M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 4 open issues on GitHub

FAQs

Alternatives & similar libraries