You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-27
Original file line number
Diff line number
Diff line change
@@ -123,36 +123,25 @@
123
123
-[`useList`](./docs/useList.md)— tracks state of an array.
124
124
-[`useMap`](./docs/useMap.md)— tracks state of an object.
125
125
126
-
## Usage
127
126
128
-
You need to have React [`16.8.0`](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html) or later installed to use the Hooks API. You can import each hook individually
129
-
130
-
```js
131
-
importuseTogglefrom'react-use/lib/useToggle'
132
-
```
133
-
134
-
or use ES6 named imports
135
-
136
-
```js
137
-
import {useToggle} from'react-use'
138
-
```
139
-
140
-
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 [`babel-plugin-import`](https://github.com/ant-design/babel-plugin-import) by adding the following config to your `.babelrc` file:
141
-
142
-
```json
143
-
[
144
-
"import", {
145
-
"libraryName": "react-use",
146
-
"libraryDirectory": "lib",
147
-
"camel2DashComponentName": false
148
-
}
149
-
]
150
-
```
151
-
152
-
<h2align="center"><sub>License</sub></h2>
127
+
<br />
128
+
<br />
129
+
<br />
130
+
<br />
131
+
<br />
132
+
<br />
133
+
<br />
153
134
154
135
<palign="center">
155
-
<ahref="./LICENSE">Unlicense</a> — public domain.
136
+
<ahref="./docs/Usage.md"><strong>Usage</strong></a> — how to import.
137
+
<br />
138
+
<ahref="./LICENSE"><strong>Unlicense</strong></a> — public domain.
You need to have React [`16.8.0`](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html) or later installed to use the Hooks API. You can import each hook individually
4
+
5
+
```js
6
+
importuseTogglefrom'react-use/lib/useToggle'
7
+
```
8
+
9
+
or use ES6 named imports
10
+
11
+
```js
12
+
import {useToggle} from'react-use'
13
+
```
14
+
15
+
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 [`babel-plugin-import`](https://github.com/ant-design/babel-plugin-import) by adding the following config to your `.babelrc` file:
0 commit comments