react-dou
TypeScript icon, indicating that this package has built-in type declarations

0.8.2 • Public • Published

React Dou

CircleCI TypeScript react-dou style: styled-components code style: prettier

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

Package Sidebar

Install

npm i react-dou

Weekly Downloads

50

Version

0.8.2

License

MIT

Unpacked Size

105 kB

Total Files

121

Last publish

Collaborators

  • nju33