How to use the rax-proptypes.func function in rax-proptypes

To help you get started, we’ve selected a few rax-proptypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax / packages / rax-create-portal / src / __tests__ / createPortal.js View on Github external
it('should update portal context if it changes due to re-render', () => {
    const container = createNodeElement('div');
    const portalContainer = createNodeElement('div');

    class Sub extends Component {
      static contextTypes = {
        foo: PropTypes.string.isRequired,
        getFoo: PropTypes.func.isRequired,
      };

      render() {
        return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
      }
    }

    class Parent extends Component {
      static childContextTypes = {
        foo: PropTypes.string.isRequired,
        getFoo: PropTypes.func.isRequired,
      };

      getChildContext() {
        return {
          foo: this.props.bar,
github alibaba / rax / packages / rax / src / vdom / __tests__ / context.js View on Github external
class MyComponent extends Component {
      static contextTypes = {
        foo: PropTypes.string.isRequired,
        getFoo: PropTypes.func.isRequired,
      };

      render() {
        return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
      }
    }

    class Parent extends Component {
      static childContextTypes = {
        foo: PropTypes.string.isRequired,
        getFoo: PropTypes.func.isRequired,
      };

      state = {
        bar: 'initial',
      };

      getChildContext() {
        return {
          foo: this.state.bar,
          getFoo: () =&gt; this.state.bar,
        };
      }

      render() {
        return ;
      }

rax-proptypes

Rax Proptypes

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

57 / 100
Full package analysis

Similar packages