How to use the di.InjectLazy function in di

To help you get started, we’ve selected a few di 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 iammerrick / the-frankenstein-framework / code / src / monsters / FrankensteinComponent.js View on Github external
import React from 'react';
import { annotate, InjectLazy }  from 'di';
import Frankenstein from './Frankenstein';

annotate(FrankensteinComponent, new InjectLazy(Frankenstein));
function FrankensteinComponent(createMonster) {
  return React.createClass({
    getInitialState() {
      return {
        loaded: false
      };
    },
    componentWillMount() {
      fetch(`https://api.github.com/users/${this.props.username}`)
        .then((response) => {
          return response.json();
        })
        .then((json) => {
          this.setState({
            user: createMonster('options', json),
            loaded: true