diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..73a934b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# useCookie Changelog + +All notable changes to this project will be documented here. This project +adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.1.0](https://github.com/tylerwolff/useCookie/compare/7273486214108568046772a6f7c3dc855609d2bd...24ec23bb2f92d3fe3b124cddba49213232583a84) (2020-06-17) + +### Features + +- Expose the `getCookie` and `setCookie` function diff --git a/README.md b/README.md index 14eae79..e236881 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ A React hook for managing cookies with no dependencies. ## Installation -``` +```bash npm install react-use-cookie ``` or -``` +```bash yarn add react-use-cookie ``` @@ -35,22 +35,16 @@ export default props => { }; ``` -You can also specify an optional third argument - an options object with the following keys: - -```tsx -{ - // The number of days the cookie is stored (defaults to 7) - days: number; - // The path of the cookie (defaults to '/') - path: string; -} -``` +`setUserToken` accepts a second argument: `options`. Different to the named +export, for this one it is the second not the third argument. Take a look at +[setCookie](#setcookie) for more details. This package also has a few other exports that can be used directly. ### `getCookie` -If you need to access a cookie outside of a React component, you can use the named `getCookie` export: +If you need to access a cookie outside of a React component, you can use the +named `getCookie` export: ```jsx import { getCookie } from 'react-use-cookie'; @@ -63,7 +57,8 @@ const getUser = () => { ### `setCookie` -If you need to set a cookie outside of a React component, you can use the named `setCookie` export: +If you need to set a cookie outside of a React component, you can use the +named `setCookie` export: ```jsx import { setCookie } from 'react-use-cookie'; @@ -72,7 +67,8 @@ const saveLocale = locale => { }; ``` -You can also specify an optional third argument - the same options object as above: +You can also specify an optional third argument - the same options object as +above: ```tsx {