@elementary/modalcontroller
v0.6.1
Published
Take control of your Modals with React
Downloads
15
Readme
@elementary/modalcontroller
Install
# install components
$ yarn add @elementary/components
Usage
- Wrap your root component with Provider
import { withModalControllerProvider } from '@elementary/modalcontroller';
const Root = withModalControllerProvider(() => <App />);
ReactDOM.render(<Root />, document.getElementById('root'));
- Wrap your user component with Consumer
import { withModalControllerConsumer } from '@elementary/modalcontroller';
const UserComponent = withModalControllerConsumer(props => <div>
<button onClick={_ => props.addModal(_ => <div style={{ position: fixed }}>Hi this is Modal</div>)}>Open Modal</button>
<div>);