score:1

class MyComponentContainer extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      a: {
        x: 0
      }, 
      b: {
        x:0
      }
    }
  }

  componentWillMount() {
     ['a', 'b'].forEach((k) => {
        request(params, (err, res) => {
           this.setState({
            a: res.a,
            b: res.b
           });
        })
     });
  }

  render() {
    return (
      <MyComponent data={this.state} />
    )
  }
}

class MyComponent extends React.Component {
  constructor (props) {
    super(props)
  }

  render() {
    return (
      <div>
        {/* display stuff here */}
      </div>
    )
  }
}

export default MyComponentContainer

Related Query

More Query from same tag