2016-03-15 29 views
0

我是很新的反應。陣營on Rails的:JSX和Coffeescritpt顯示@props

如何使用JsxCoffeeScript顯示@props

在我的文件records.js.jsx.coffee我有下面的代碼顯示記錄的日期和標題:

@Record = React.createClass 
    render: -> 
    `<tr> 
     <td>{@props.record.date}</td> 
     <td>{@props.record.title}</td> 
    </tr>` 

我收到的錯誤是SyntaxError: unknown: Unexpected token (5:11)

我希望我可以使用回躲避碼蜱`

回答

0
@Record = React.createClass 
    render: -> 
    `<tr> 
     <td>{this.props.record.date}</td> 
     <td>{this.props.record.title}</td> 
    </tr>` 

使用this代替@符號的工作。

從我已閱讀@符號編譯成windowthis我會使用CoffeeScript的

預料