render() {
    // The complex reduce function is done to distribute the examples into an array of arrays where each array is at most {gridWidth}
    // length
    return (
      <div>
        {this.state.examples && this.state.examples.reduce((acc, example, i) => {
          const gridWidth = 3
          const chunkSize = Math.floor(i / gridWidth)

          if (!acc[chunkSize]) {
            acc[chunkSize] = []
          }

          acc[chunkSize].push(example)

          return acc
        }, []).map((exampleRow, i) => (
          <Row key={i}>
            {exampleRow.map((example, j) => this.renderExample(example, j))}
          </Row>
          ))
        }
      </div>
    )
  }
// Produces a list of the examples in a grid of 3xN
Produces a list of the examples in a grid of 3xN
Produces a list of the examples in a grid of 3xN
render() {
    return (
      <div>
        {this.state.examples && this.state.examples.reduce((acc, example, i) => {
          const gridWidth = 3
          const chunkSize = Math.floor(i / gridWidth)
          if (!acc[chunkSize]) {
            acc[chunkSize] = []
          }
          acc[chunkSize].push(example)
          return acc
        }, []).map((exampleRow, i) => (
          <Row key={i}>
            {exampleRow.map((example, j) => this.renderExample(example, j))}
          </Row>
          ))
        }
      </div>
    )
  }
render ( ) { return ( < div > { this . state . examples && this . state . examples . reduce ( ( acc , example , i ) => { const gridWidth = 3 const chunkSize = Math . floor ( i / gridWidth ) if ( ! acc [ chunkSize ] ) { acc [ chunkSize ] = [ ] } acc [ chunkSize ] . push ( example ) return acc } , [ ] ) . map ( ( exampleRow , i ) => ( < Row key = { i } > { exampleRow . map ( ( example , j ) => this . renderExample ( example , j ) ) } < / Row > ) ) } < / div > ) }
Produces a list of the examples in a grid of 3xN
Produces a list of the examples in a grid of 3xN
// The complex reduce function is done to distribute the examples into an array of arrays where each array is at most {gridWidth} // length