Skip to content

Commit fef3544

Browse files
committed
docs: update docs to use new API
1 parent 3cc7655 commit fef3544

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ In addition, it doesn't directly alters the DOM, everything is handled by React.
1111
## Installation
1212

1313
```
14-
yarn add react-resize-aware@3.0.0-beta.1
14+
yarn add react-resize-aware@3.0.0-beta.3
1515
```
1616

1717
or with npm:
1818

1919
```
20-
npm install --save react-resize-aware@3.0.0-beta.1
20+
npm install --save react-resize-aware@3.0.0-beta.3
2121
```
2222

2323
## Usage
@@ -30,11 +30,11 @@ import React from 'react';
3030
import useResizeAware from 'react-resize-aware';
3131

3232
const App = () => {
33-
const [ResizeListener, sizes] = useResizeAware();
33+
const [resizeListener, sizes] = useResizeAware();
3434

3535
return (
3636
<div style={{ position: 'relative' }}>
37-
<ResizeListener />
37+
{resizeListener}
3838
Your content here. (div sizes are {sizes.width} x {sizes.height})
3939
</div>
4040
);
@@ -47,11 +47,11 @@ const App = () => {
4747

4848
The Hook returns an array with two elements inside:
4949

50-
### `[ResizeListener, ...]` (first element)
50+
### `[resizeListener, ...]` (first element)
5151

52-
This is an invisible component that must be placed as direct-child of the HTMLElement you want to listen the resize events of.
52+
This is an invisible React node that must be placed as direct-child of the HTMLElement you want to listen the resize events of.
5353

54-
The component is not going to interfer with your layouts, I promise.
54+
The node is not going to interfer with your layouts, I promise.
5555

5656
### `[..., sizes]` (second element)
5757

@@ -66,11 +66,11 @@ const customReporter = element => ({
6666
clientWidth: target != null ? target.clientWidth : null,
6767
});
6868

69-
const [ResizeListener, sizes] = useResizeAware(customReporter);
69+
const [resizeListener, sizes] = useResizeAware(customReporter);
7070

7171
return (
7272
<div style={{ position: 'relative' }}>
73-
<ResizeListener />
73+
{resizeListener}
7474
Your content here. (div clientWidth is {sizes.clientWidth})
7575
</div>
7676
);

docs/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@
3838
clientWidth: target != null ? target.clientWidth : null,
3939
});
4040

41-
const [ResizeListener, sizes] = useResizeAware(reporter);
41+
const [resizeListener, sizes] = useResizeAware(reporter);
4242

4343
return (
4444
<div className="example">
45-
<ResizeListener />
46-
Your content here. (div sizes are {sizes.width} x {sizes.height}, clientWidth is {sizes.clientWidth}px)
45+
{resizeListener}
46+
Your content here. (div sizes are {sizes.width} x {sizes.height},
47+
clientWidth is {sizes.clientWidth}px)
4748
</div>
4849
);
4950
};

docs/react-resize-aware.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)