README
rc-mount
react extra component mount decorator
Development
yarn
npm start
open http://localhost:3000
Install
Usage
// Modal.js
import React, { Component } from 'react';
impot mount from 'rc-mount';
@mount()
export default class Modal extends Component {
render() {
return (
<div>
This is modal content
<button onClick={this.props.destroy}>关闭</button>
</div>
);
}
}
// index.js
import Modal from './Modal.js';
Modal.show();
Modal.destroy()'
decorator(options:Object)=>(WrappedComponent: React.Component)=>React.Component
| option | description | type | default |
|---|---|---|---|
| element | render container | string | div |
return {
show: (props)=>destroy,
destroy: null
}
