Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
Forked from anonymous/game.coffee
Last active August 29, 2015 14:11
Show Gist options
  • Save jethrolarson/6c6351b40b77b767123a to your computer and use it in GitHub Desktop.
Save jethrolarson/6c6351b40b77b767123a to your computer and use it in GitHub Desktop.
React = require 'react'
{map} = require 'ramda'
{div, ul, li, button} = require ('./tag')
React.render ( div [
div [
'Assets:',
ul map ((a)-> li [a.type]), w.player.assets
]
button {onClick: act 'hurtAliens'}, 'Hurt aliens'
button {onClick: act 'getHelp'}, 'Get help'
]), document.getElementById 'game'
React = require 'react'
{isArrayLike} = require 'ramda'
# str -> fn
tag = (name) -> (args...)->
if isArrayLike args[0]
attrs = null
children = args
else
attrs = args[0]
children = args.slice 1
React.createElement name, attrs, children...
module.exports =
tag: tag
div: tag 'div'
button: tag 'button'
h1: tag 'h1'
ul: tag 'ul'
li: tag 'li'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment