Created
November 26, 2016 21:07
-
-
Save kieran/a09497c0fb09979c138dbfc596eeb83a to your computer and use it in GitHub Desktop.
react routes example (in routes/big_calendar)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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