0

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 `

srm
  • 655
  • 1
  • 8
  • 21

1 Answers1

0
@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

srm
  • 655
  • 1
  • 8
  • 21