Korat
Tiny tool for react/react-native with pure functions. no closing tags, no braces.
Made by coffeescript. but it is useful with javascript.
It's just a thin wrapper around React.createElement like JSX.
but more simple and concise. fun with the Korat!
Installation
$ npm install korat --save
Usage
in React
React = require 'react' Reactk = require 'korat' : super props @state = newTodo: "" : -> k 'div' k 'h2''Todos' k 'ul' k 'li'key: v". Task" for v in 0..5 k NewTodotodo: @statenewTodo k 'button' : @addNewTodo : super props @state = todo: propstodo : -> k 'div' k 'label''for': 'addTodo''Add Todo' k 'input' id: 'addTodo' type: 'text' value: @propstodo : @propstodo = etargetvalueReactDOMrender kApp documentgetElementById 'container'
in React-Native
React = require 'react' React StyleSheet Text View = require 'react-native'k = require 'korat' : -> k Viewstyle: stylescontainer k Text"Open up main.js to start working on your app." k View k Textkey:v"number" for v in 1..5styles = StyleSheetcreate container: flex: 1 backgroundColor: '#fff' alignItems: 'center' justifyContent: 'center'
Thanks to
@jungheelee