-
-
Save jethrolarson/6c6351b40b77b767123a to your computer and use it in GitHub Desktop.
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
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' |
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
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