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