Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit bf6eb8f

Browse files
authoredDec 26, 2022
Added deprecation notice
1 parent a2210c2 commit bf6eb8f

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed
 

‎README.md

+10-34
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
11
# @zeecoder/react-resize-observer
22

3-
A React component that allows you to use a ResizeObserver to measure an element's size.
3+
This package is now **officially deprecated**.
4+
Use the [use-resize-observer](https://github.com/ZeeCoder/use-resize-observer) hook instead.
45

5-
[![npm version](https://badge.fury.io/js/%40zeecoder%2Freact-resize-observer.svg)](https://npmjs.com/package/@zeecoder/react-resize-observer)
6-
[![build](https://travis-ci.org/ZeeCoder/react-resize-observer.svg?branch=master)](https://travis-ci.org/ZeeCoder/react-resize-observer)
6+
If you want the old API, then create a react component, like so:
7+
```tsx
8+
import useResizeObserver from "use-resize-observer";
79

8-
## Install
10+
export default function({ children }) {
11+
const { ref, width, height } = useResizeObserver();
912

10-
```
11-
yarn add @zeecoder/react-resize-observer
12-
# or
13-
npm install --save @zeecoder/react-resize-observer
14-
```
13+
return children(ref, width, height);
14+
}
1515

16-
## Usage
17-
18-
```js
19-
const App = () => (
20-
<ResizeObserver>
21-
{(ref, width, height) => (
22-
<div ref={ref}>
23-
My size is {width}x{height}
24-
</div>
25-
)}
26-
</ResizeObserver>
27-
);
2816
```
2917

30-
## Notes
31-
32-
- Uses [resize-observer-polyfill](https://github.com/que-etc/resize-observer-polyfill)
33-
internally, which falls back to the native ResizeObserver, if available.
34-
35-
## Related
36-
37-
- [use-resize-observer](https://github.com/ZeeCoder/use-resize-observer)
38-
- [@zeecoder/container-query](https://github.com/ZeeCoder/container-query)
39-
40-
## License
41-
42-
MIT
18+
Alternatively, see the last readme for v2 [here](https://github.com/ZeeCoder/react-resize-observer/tree/v2.0.0#zeecoderreact-resize-observer).

0 commit comments

Comments
 (0)