Last active
March 20, 2018 15:37
-
-
Save steida/b975439378980911ee4d to your computer and use it in GitHub Desktop.
I love Coffee React with dependency injection.
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
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