Skip to content

Instantly share code, notes, and snippets.

@kieran
Created November 26, 2016 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kieran/a09497c0fb09979c138dbfc596eeb83a to your computer and use it in GitHub Desktop.
Save kieran/a09497c0fb09979c138dbfc596eeb83a to your computer and use it in GitHub Desktop.
react routes example (in routes/big_calendar)
{ connect } = require 'react-redux'
# provide state
mapStateToProps = (state)->
{ events, eventsLoading } = state
{ events, eventsLoading }
# provide actions
{ getEvents } = require 'actions/events'
mapDispatchToProps = (dispatch)->
{ getEvents }
module.exports =
connect mapStateToProps, mapDispatchToProps
require './index.sass'
# get some components to render
BigCalendarComp = require 'components/big_calendar'
Spinner = require 'components/spinner'
# require the container / connect function
# that connects state / actions to props
container = require './container'
module.exports =
container class BigCalendar extends React.Component
render: ->
<div className="BigCalendar">
{if @props.eventsLoading
<Spinner/>
else
<BigCalendarComp events={@props.events}/>
}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment