How to use the inferno.Component function in inferno

To help you get started, we’ve selected a few inferno 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 zanettin / incompose / dist / componentFromStream.js View on Github external
key: "componentWillUnmount",
        value: function componentWillUnmount() {
          // Call without arguments to complete stream
          this.propsEmitter.emit(); // Clean-up subscription before un-mounting

          this.subscription.unsubscribe();
        }
      }, {
        key: "render",
        value: function render() {
          return this.state.vdom;
        }
      }]);

      return ComponentFromStream;
    }(_inferno.Component), _temp;
  };
};
github deamme / laco / index.ts View on Github external
export let Component

// let jsanParse
let devTools
let persistedStore

try {
  Component = require('react').Component
} catch (error) {
  /* Fail silent */
}
try {
  Component = require('inferno').Component
} catch (error) {
  /* Fail silent */
}

if (!Component) {
  throw 'Please require Inferno or React'
}

if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'production') {
  console.error(`You're currently using a development version of Laco`)
  // jsanParse = require('jsan').parse
  if ((window as any).__REDUX_DEVTOOLS_EXTENSION__) {
    devTools = (window as any).__REDUX_DEVTOOLS_EXTENSION__.connect()
    // const persistedStore = jsanParse(localStorage.getItem('__LACO__'))
    const content = localStorage.getItem('__LACO__')
    if (content) {
github cerebral / cerebral / debugger / src / components / Debugger / index.js View on Github external
import './styles.css'
import Inferno from 'inferno'
import jsonStorage from 'electron-json-storage'
import connector from 'connector'
import {Controller} from 'cerebral'
import {Container} from 'cerebral/inferno'
import UserAgent from '@cerebral/useragent'
import DebuggerModule from '../../modules/Debugger'

import AddApp from './AddApp'
import App from './App'
import Apps from './Apps'

class Debugger extends Inferno.Component {
  constructor (props) {
    super(props)
    this.state = {
      isLoading: true,
      apps: {},
      currentApp: null,
      showAddApp: false,
      error: null
    }
    this.addPort = this.addPort.bind(this)
    this.addNewPort = this.addNewPort.bind(this)
    this.cancelAddNewPort = this.cancelAddNewPort.bind(this)
    this.changePort = this.changePort.bind(this)
    this.removePort = this.removePort.bind(this)
  }
  componentDidMount () {
github cerebral / cerebral / packages / cerebral / src / inferno / hoc.js View on Github external
import Inferno from 'inferno'
import createElement from 'inferno-create-element'
import Component from 'inferno-component'
import Hoc from './../viewFactories/Hoc'

Inferno.createElement = createElement
Inferno.Component = Component

export default Hoc(Inferno)
github marko-js / isomorphic-ui-benchmarks / benchmarks / search-results / inferno / components / SearchResultsItem.jsx View on Github external
var Inferno = require("inferno");
var Component = Inferno.Component;
var createVNode = Inferno.createVNode;
var linkEvent = Inferno.linkEvent;

function handleBuyButtonClick(instance, event) {
  instance.setState({ purchased: true });
}

module.exports = class extends Component {
  constructor(props) {
    super(props);

    this.state = {
      purchased: false
    };
  }
github zanettin / incompose / dist / withPropsOnChange.js View on Github external
_createClass(_temp, [{
        key: "componentWillReceiveProps",
        value: function componentWillReceiveProps(nextProps) {
          if (shouldMap(this.props, nextProps)) {
            this.computedProps = propsMapper(nextProps);
          }
        }
      }, {
        key: "render",
        value: function render() {
          return (0, _inferno.normalizeProps)((0, _inferno.createComponentVNode)(2, BaseComponent, _objectSpread({}, Object.assign(this.props, this.computedProps))));
        }
      }]);

      return _temp;
    }(_inferno.Component), _temp;
  };
};
github zanettin / incompose / dist / withState.js View on Github external
});

        return _this;
      }

      _createClass(StatedComponent, [{
        key: "render",
        value: function render() {
          var _Object$assign;

          return (0, _inferno.normalizeProps)((0, _inferno.createComponentVNode)(2, BaseComponent, _objectSpread({}, Object.assign(this.props, (_Object$assign = {}, _defineProperty(_Object$assign, stateName, this.state.stateValue), _defineProperty(_Object$assign, stateUpdaterName, this.updateStateValue), _Object$assign)))));
        }
      }]);

      return StatedComponent;
    }(_inferno.Component), _temp);
    return function (props) {
      return (0, _inferno.normalizeProps)((0, _inferno.createComponentVNode)(2, StatedComponent, _objectSpread({}, props)));
    };
  };
};
github cerebral / cerebral / debugger / src / components / Debugger / Inspector / index.js View on Github external
highlightPath={highlightPath} />
    )
  }

  return (
    
  )
}

class ObjectValue extends Inferno.Component {
  constructor (props, context) {
    super(props)
    const isHighlightPath = !!(this.props.highlightPath && isInPath(this.props.highlightPath, this.props.path))
    const preventCollapse = (this.props.path.length === 0) && context.options.expanded

    this.state = {
      isCollapsed: !preventCollapse && !isHighlightPath
    }

    this.onCollapseClick = this.onCollapseClick.bind(this)
    this.onExpandClick = this.onExpandClick.bind(this)
  }
  componentWillReceiveProps (nextProps) {
    const context = this.context
    const props = nextProps
    const isHighlightPath = !!(props.highlightPath && isInPath(props.highlightPath, props.path))
github cerebral / cerebral / packages / cerebral / src / viewFactories / inferno.js View on Github external
import Inferno from 'inferno'
import createElement from 'inferno-create-element'
import Component from 'inferno-component'
import ContainerFactory from './Container'
import StateContainerFactory from './StateContainer'
import HocFactory from './Hoc'
import connectFactory, { decoratorFactory } from './connect'

Inferno.createElement = createElement
Inferno.Component = Component

export const Container = ContainerFactory(Inferno)
export const StateContainer = StateContainerFactory(Inferno)
export const connect = connectFactory(HocFactory(Inferno))
export const decorator = decoratorFactory(HocFactory(Inferno))
github cerebral / cerebral / debugger / src / components / Debugger / Signals / index.js View on Github external
import {state, signal} from 'cerebral/tags'
import signalsList from '../../../common/computed/signalsList'
import connector from 'connector'

import List from './List'
import Signal from './Signal'

export default connect({
  currentPage: state`debugger.currentPage`,
  signalsList: signalsList,
  useragent: state`useragent`,
  currentSignalExecutionId: state`debugger.currentSignalExecutionId`,
  isExecuting: state`debugger.isExecuting`,
  resetClicked: signal`debugger.resetClicked`
},
  class Signals extends Inferno.Component {
    constructor (props) {
      super(props)
      this.state = {copiedSignals: null}
    }
    shouldComponentUpdate (nextProps, nextState) {
      return (
        this.props.currentPage !== nextProps.currentPage ||
        this.props.useragent.media.small !== nextProps.useragent.media.small ||
        this.props.currentSignalExecutionId !== nextProps.currentSignalExecutionId ||
        this.props.mutationsError !== nextProps.mutationsError ||
        this.state.copiedSignals !== nextState.copiedSignals ||
        this.props.isExecuting !== nextProps.isExecuting
      )
    }
    onResetClick () {
      this.props.resetClicked()