# rc-mount

> react extra component mount decorator

Latest version **2.1.0** (published 2024-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install rc-mount
pnpm add rc-mount
yarn add rc-mount
bun add rc-mount
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2024-09-23 |
| First published | 2017-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | yeliex |
| Maintainers | yeliex |
| Keywords | react, react-component, react-com, antd |

## Links

- npm: https://www.npmjs.com/package/rc-mount
- Repository: https://github.com/yeliex/rc-mount
- Homepage: https://github.com/yeliex/rc-mount#readme
- Issues: https://github.com/yeliex/rc-mount/issues
- npm.io page: https://npm.io/package/rc-mount

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2024-09-23
- 2.0.3 — 2023-12-18
- 2.0.2 — 2022-01-09
- 2.0.1 — 2022-01-09
- 2.0.0 — 2022-01-09
- 1.0.3 — 2019-05-14
- 1.0.2 — 2018-04-16
- 1.0.1 — 2018-02-24
- 1.0.0 — 2018-02-24
- 0.0.1 — 2017-12-25

## README

# rc-mount

react extra component mount decorator

[![NPM version][npm-image]][npm-url]
[![gemnasium deps][gemnasium-image]][gemnasium-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-mount.svg?style=flat-square

[npm-url]: http://npmjs.org/package/rc-mount

[gemnasium-image]: http://img.shields.io/gemnasium/yeliex/rc-mount.svg?style=flat-square

[gemnasium-url]: https://gemnasium.com/yeliex/rc-mount

[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square

[node-url]: http://nodejs.org/download/

[download-image]: https://img.shields.io/npm/dm/rc-mount.svg?style=flat-square

[download-url]: https://npmjs.org/package/rc-mount

## Install

```bash
yarn add rc-mount
# OR
npm i --save rc-mount
```

## Usage

```typescript jsx
// Modal.tsx
import mount, { ComponentMountProps } from 'rc-mount';

interface IProps {
    value: string;
}

const Modal = (props: IProps & ComponentMountProps<string>) => {
    const handleClick = () => {
        props.resolve(props.value);

        setTimeout(() => {
            props.destroy();
        }, 300);
    };

    return (
        <div>
            <p>{props.value}</p>
            <button onClick={handleClick}>click</button>
        </div>
    );
};

export const show = mount()(Modal);

export default Modal;

// index.tsx
import { show as showModal } from './Modal.js';

const res = await showModal();

// OR
const promise = showModal();

promise.destroy();

await promise;
```

## ```mount(options:Object)=>(WrappedComponent: React.Component)=>React.Component```

| option | description | type | default |
| --- | --- | --- | --- |
| element | render container | string | div |

---
_Source: https://npm.io/package/rc-mount · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
