I am following a tutorial about how to use React within Rails. My component seems to be throwing an error. Here is my component:
@Lifts = React.createClass
getInitialState: ->
lifts: @props.data
getDefaultProps: ->
lifts: []
render: ->
React.DOM.div
className: 'lifts'
React.DOM.h1
className: 'title'
'Lifts'
React.DOM.table
className: 'table table-bordered'
React.DOM.thead null,
React.DOM.th null, 'Date'
React.DOM.th null, 'Lift Name'
React.DOM.th null, 'Weight Lifted'
React.DOM.th null, 'Reps Performed'
React.DOM.th null, '1 RM'
React.DOM.tbody null,
for lift in @state.lifts
React.createElement Lift, key: lift.id, lift: lift
I get this error from Rails:
SyntaxError: [stdin]:4:1: unexpected indentation
One, can anyone see what my error is? I am basically brand new to coffeescript and I can't see what I'm doing wrong.
Two, for my own information, is coffeescript more used than JSX? I've used the JSX format before and found it easier. If JSX is more used, can anyone recommend a tutorial that uses JSX and Rails?