Added named import example to readme

This commit is contained in:
Ward Oosterlijnck 2019-04-08 21:39:28 +10:00
parent 418438ec22
commit 1a63a0dc0d

View File

@ -136,7 +136,11 @@ You can import each hook individually <code>import useToggle from 'react-use/lib
</p>
<p align="center">
Depending on your bundler you might run into a missing dependency error. Some hooks require you to install peer dependencies so we recommend using individual imports. If you want the best of both worlds you can transform the named import statements to individual import statements with <a href="https://github.com/ant-design/babel-plugin-import">babel-plugin-import</a> by adding the following config to your `.babelrc` file:
or use ES6 named imports <code>import {useToggle} from 'react-use'</code>.
</p>
<p align="center">
Depending on your bundler you might run into a missing dependency error with ES6 named import statements. Some hooks require you to install peer dependencies so we recommend using individual imports. If you want the best of both worlds you can transform the named import statements to individual import statements with <a href="https://github.com/ant-design/babel-plugin-import">babel-plugin-import</a> by adding the following config to your `.babelrc` file:
</p>
```json