为什么 createElement 会阻止 DOM 在 react-rails 中加载?

why does createElement prevent the DOM from loading in react-rails?

我正在经历这个 tutorial,在我更改记录组件并在两个 DOM 渲染之间添加 React.createElement RecordForm, handleNewRecord: @addRecord 之前一直很好。似乎干扰并阻止了 DOM 的渲染。

组件如下:

@Records = React.createClass
  getInitialState: ->
    records: @props.data
  getDefaultProps: ->
    records: []
  addRecord: (record) ->
    records = @state.records.slice()
    records.push record
    @setState records: records
  render: ->
    React.DOM.div
      className: 'records'
      React.DOM.h2
        className: 'title'
        'Records'
      React.createElement RecordForm, handleNewRecord: @addRecord
      React.DOM.hr null
      React.DOM.table
        className: 'table table-bordered'
        React.DOM.thead null,
          React.DOM.tr null,
            React.DOM.th null, 'Date'
            React.DOM.th null, 'Title'
            React.DOM.th null, 'Amount'
        React.DOM.tbody null,
          for record in @state.records
            React.createElement Record, key: record.id, record: record

控制台错误显示 "Uncaught ReferenceError: RecordForm is not defined"。是的,我知道,它是:

@RecordForm = React.createClass
 bla bla bla bla
 handleChange: (e) ->
   name = e.target.name
   @setState "#{ name }": e.target.value
 handleSubmit: (e) ->
    e.preventDefault()
    $.post '', { record: @state }, (data) =>
      @props.handleNewRecord data
      @setState @getInitialState()
    , 'JSON'
  render: ->
    React.DOM.form
     bla bla bla bla

什么给了?

看起来我在 handleChange 之前有一个意外的 space。在每个函数之间添加换行符解决了它。 >:/