title: React component don't see helper class. Why?
body: <p>I'm doing React tutorial about Tic Tac Toe game. I decided to create helper class Squares, to store 2D game field status.</p>
  
  <pre><code>  class Squares {
      constructor(size) {
        this._size = size
        this._squares = Array(size * size).fill(null)
      }
      square(row, col, value) {
        let position = (row - 1) * this._size + col - 1
        if (value !== undefined)
          this._squares[position] = value
        return this._squares[position]
      }
      get size() {
        return this._size
      }
      get copy() {
        let squares = new Squares(this._size)
        squares._squares = this._squares.slice()
        return squares
      }
    }
  </code></pre>
  
  <p>And use it in component's state, like this.</p>
  
  <pre><code>class Game extends React.Component {
    constructor() {
      super()
      this.state = {
        history: [{
          squares: new Squares(3)
        }],
        stepNumber: 0,
        xIsNext: true,
      }
    }
  </code></pre>
  
  <p>But then I got error. 
  <em>"TypeError: Squares is not a constructor"</em></p>
  
  <p>Inside component Squares is undefined! But when I warp my class into function.</p>
  
  <pre><code>function Squares(size) {
    class Squares {
      ...
    }
    return new Squares(size)
  }
  </code></pre>
  
  <p>.. component class can see my class now! 
  But why? What difference between class and function?</p>