I am very new to React.
How do I display @props
using Jsx
and CoffeeScript
?
In my file records.js.jsx.coffee
I have the following code to display a record's date and title:
@Record = React.createClass
render: ->
`<tr>
<td>{@props.record.date}</td>
<td>{@props.record.title}</td>
</tr>`
The error I am receiving is SyntaxError: unknown: Unexpected token (5:11)
I was hoping I could escape the code using the back ticks `
@Record = React.createClass
render: ->
`<tr>
<td>{this.props.record.date}</td>
<td>{this.props.record.title}</td>
</tr>`
Using this
instead of the @
symbol worked.
From what I have read the @
symbol compiles to window
not this
as I would have expected using CoffeeScript