Skip to content

Commit 69b8f01

Browse files
committed
copied example to readme
1 parent 0ff53e6 commit 69b8f01

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ Install it with
1818
npm install react-resize-aware --save
1919
```
2020

21+
# Usage
22+
23+
```jsx
24+
import React, { Component } from 'react'
25+
import { findDOMNode } from 'react-dom'
26+
import ResizeAware from 'react-resize-aware'
27+
28+
export default class FooBar extends Component {
29+
render() {
30+
return (
31+
<ResizeWare ref='container'>
32+
Hello, World!
33+
</ResizeAware>
34+
)
35+
}
36+
37+
componentDidMount() {
38+
findDOMNode(this.refs.container).addEventListener((evt) => {
39+
console.log('Component has been resized!')
40+
})
41+
}
42+
}
43+
```
44+
45+
2146
# License
2247

2348
MIT License

0 commit comments

Comments
 (0)