yarn add react-cookies -D
import cookie from ‘react-cookies’
存
cookie.save(‘userId’, “123”{
path: ‘/’,
expires,
maxAge: 1000, // maxAge 单位秒
domain: ‘https://play.bukinoshita.io’,
secure: true
httpOnly: true
})
取
cookie.load(‘userId’)
删
cookie.remove(‘userId’)
https://www.npmjs.com/package/react-cookies