Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/yeliex/rc-promisify

make react-components promisify 🎡
https://github.com/yeliex/rc-promisify

Last synced: about 2 months ago
JSON representation

make react-components promisify 🎡

Awesome Lists containing this project

README

        

# rc-promisify

make react-components promisify 🎡

# Usage

```bash
npm install rc-promisify
# OR
yarn add rc-promisify
```

```tsx
import { Promisify } from 'rc-promisify';
import { Button, Switch } from 'antd';

const App = () => {
const handleClick = async () => {
return new Promise((resolve) => {
setTimeout(resolve, 3000)
});
};

return (
<>



>
)
};
```

# API Reference
## Promisify
- `component: React.ComponentType` any ReactComponent with event callback and `loading` props
- `trigger: string | string[]` event(s) to hijack
- `...props` any other props of `component`