Skip to content

Latest commit

 

History

History
72 lines (42 loc) · 1.49 KB

readme.md

File metadata and controls

72 lines (42 loc) · 1.49 KB

react-cookies

Load and save cookies with React

Install

$ yarn add react-cookies

API

.setCookie(name, value, [options])

Set a cookie.

name

The cookie name

Type: string
Required

value

The cookie value

Type: any
Required

options

Support all the cookie options from the RFC 6265.

Type: object

  • expire: Indicates the maximum lifetime of the cookie represented as the date and time
  • maxAge: Indicates the maximum lifetime of the cookie represented as the number of seconds
  • domain: Specifies those hosts to which the cookie will be sent
  • path: The scope of each cookie is limited to a set of paths
  • secure: Limits the scope of the cookie to "secure" channels (where "secure" is defined by the user agent)
  • httpOnly: Limits the scope of the cookie to HTTP requests

.getCookie(name)

Get a cookie.

name

The cookie name.

Type: string
Required

.removeCookie(name)

Remove a cookie.

name

The cookie name.

Type: string
Required

.getAllCookies()

Get all cookies.

License

MIT © Bu Kinoshita