An open API service indexing awesome lists of open source software.

https://github.com/afeiship/class-imperative-handle

React `useImperativeHandle` for class component.
https://github.com/afeiship/class-imperative-handle

forwardref react ref useimperativehandle

Last synced: 3 days ago
JSON representation

React `useImperativeHandle` for class component.

Awesome Lists containing this project

README

        

# class-imperative-handle
> React `useImperativeHandle` for class component.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install @jswork/class-imperative-handle
```

## usage
```js
import classImperativeHandle from '@jswork/class-imperative-handle';

class MyComponent extends Component {
handleRef = (inRoot) => {
const { forwardedRef } = this.props;
classImperativeHandle(forwardedRef, inRoot);
this.root = inRoot;
};

render() {
return (


);
}
}

export default React.forwardRef((props: ReactCheckboxProps, ref: any) => (

));
```

## license
Code released under [the MIT license](https://github.com/afeiship/class-imperative-handle/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/class-imperative-handle
[version-url]: https://npmjs.org/package/@jswork/class-imperative-handle

[license-image]: https://img.shields.io/npm/l/@jswork/class-imperative-handle
[license-url]: https://github.com/afeiship/class-imperative-handle/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/class-imperative-handle
[size-url]: https://github.com/afeiship/class-imperative-handle/blob/master/dist/class-imperative-handle.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/class-imperative-handle
[download-url]: https://www.npmjs.com/package/@jswork/class-imperative-handle