How to use the inferno-compat.Component function in inferno-compat

To help you get started, we’ve selected a few inferno-compat 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 infernojs / inferno / packages / inferno-compat / __tests__ / misc.spec.jsx View on Github external
it('should be exported', () => {
      expect(React.Component).toEqual(Component);
    });
  });
github infernojs / inferno / packages / inferno-compat / __tests__ / ReactES6Class.spec.jsx View on Github external
constructor(props, context) {
        super(props, context);

        this.state = { tag: context.tag, className: this.context.className };
      }
      render() {
        var Tag = this.state.tag;
        return ;
      }
    }
    Foo.contextTypes = {
      tag: React.PropTypes.string,
      className: React.PropTypes.string
    };

    class Outer extends React.Component {
      getChildContext() {
        return { tag: 'span', className: 'foo' };
      }
      render() {
        return ;
      }
    }
    Outer.childContextTypes = {
      tag: React.PropTypes.string,
      className: React.PropTypes.string
    };
    test(, 'SPAN', 'foo');
  });
github infernojs / inferno / packages / inferno-compat / __tests__ / ReactES6Class.spec.jsx View on Github external
it('will call all the normal life cycle methods', function() {
    var lifeCycles = [];
    class Foo extends React.Component {
      constructor() {
        super();
        this.state = {};
      }
      componentWillMount() {
        lifeCycles.push('will-mount');
      }
      componentDidMount() {
        lifeCycles.push('did-mount');
      }
      componentWillReceiveProps(nextProps) {
        lifeCycles.push('receive-props', nextProps);
      }
      shouldComponentUpdate(nextProps, nextState) {
        lifeCycles.push('should-update', nextProps, nextState);
        return true;
github infernojs / inferno / packages / inferno-compat / __tests__ / ReactES6Class.spec.jsx View on Github external
it('supports this.context passed via getChildContext', function() {
    class Bar extends React.Component {
      render() {
        return <div>;
      }
    }
    Bar.contextTypes = { bar: React.PropTypes.string };
    class Foo extends React.Component {
      getChildContext() {
        return { bar: 'bar-through-context' };
      }
      render() {
        return ;
      }
    }
    Foo.childContextTypes = { bar: React.PropTypes.string };
    test(, 'DIV', 'bar-through-context');
  });</div>
github infernojs / inferno / packages / inferno-compat / __tests__ / ReactES6Class.spec.jsx View on Github external
beforeEach(function() {
    container = document.createElement('div');
    attachedListener = null;
    renderedName = null;
    Inner = class extends React.Component {
      getName() {
        return this.props.name;
      }
      render() {
        attachedListener = this.props.onClick;
        renderedName = this.props.name;
        return <div>;
      }
    };
  });
</div>