2016-03-15 54 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的

预料