Skip to content

Instantly share code, notes, and snippets.

@steida
Last active March 20, 2018 15:37
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steida/b975439378980911ee4d to your computer and use it in GitHub Desktop.
Save steida/b975439378980911ee4d to your computer and use it in GitHub Desktop.
I love Coffee React with dependency injection.
goog.provide 'app.react.App'
class app.react.App
###*
@param {app.Routes} routes
@param {app.react.Header} header
@param {app.react.Footer} footer
@param {app.react.pages.Home} home
@param {app.react.pages.EditSong} editSong
@param {app.react.pages.Song} song
@param {app.react.pages.NotFound} notFound
@constructor
###
constructor: (routes,
header, footer,
home, editSong, song, notFound) ->
{div} = React.DOM
@component = React.createClass
render: ->
div className: 'app',
header.component()
switch routes.active
when routes.home then home.component()
when routes.newSong, routes.editMySong then editSong.component()
when routes.mySong then song.component()
when routes.notFound then notFound.component()
footer.component()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment