colshacol
10/1/2017 - 1:03 AM

Partials: Bad.

Partials: Bad.

class Thingy extends Component {
  state = { num: 90 }

  renderPart0() {
    const { a, b } = this.props;
    return (
      <div>
        <p>{a}</p>
        <small>{b}</small>
        {this.renderPart1()}
      </div>
    )
  }
  
  renderPart1() {
    const { c, d } = this.props;
    const { num } = this.state;
    const newNum = num / 2;
    return (
      <div>
        <ul>
          <li>{c}</li>
          <li>{d}</li>
          <li>{newNum}</li>
        </ul>
      </div>
    )
  }

  render() {
    const { a, b, c, d } = this.props;
    // logic and computed values...
    return (
      <section>
        {/* a bunch of JSX */}
        {this.renderPart0()}
      </section>
    )
  }
}