# @cjsx React.DOM React = require('react') Card = require('./card') module.exports = React.createClass displayName: 'Cards' getInitialState: ()-> error: false componentDidMount: ()-> console.log 'component did mount' @props.cards.on 'sync', @forceUpdate.bind(@, null) @props.card.on 'sync', @forceUpdate.bind(@, null) @props.card.on 'error', (model, response)=> @setState error: response @forceUpdate.bind(@, null) render: -> console.log 'render cards', @props.cards, @state if @state.error
{ for i in [1..9]
{@state.error.status} {@state.error.statusText}
}
else if !@props.cards.fetching console.log 'cards loaded' cards = @props.cards.map (card)->
{cards}
else console.log 'cards loading'
{ for i in [1..9]
Loading ...
}