react-dou
v0.8.2
Published
A React's yes-no modal component
Downloads
77
Readme
React Dou
Install
yarn add react-dou react react-dom styled-components # @types/react @types/react-dom @types/styled-components
Example
by DouFunctionsConsumer
(
<DouProvider callback={callback}>
<DouFunctionsConsumer>
{({ask}) => {
return (
<button onClick={ask('ハンバーガー食べますか?')}>ハンバーガー食べますか?</button>
);
}}
</DouFunctionsConsumer>
<Dou />
</DouProvider>
)
by withDou
interface Props {
text: string;
}
class IComponent extends React.Component<
Props & Partial<DouFunctionsProps>,
{a: string}
> {
// @ts-ignore
props: Props & DouFunctionsProps
render() {
return (
<button onClick={this.props.dou.ask('message')}>{this.props.text}</button>
);
}
}
const IComponentWithDou = withDou<Props>(IComponent);
References
License
MIT