sweetreaction
A collection of Sweet.js macros for the excellent React library.
You can use it together with jsx-reader or react.hiccup -- or both if you want some chaos :D
Usage
Something like this:
$ npm install sweet.js jsx-reader sweetreaction$ sjs -r -l jsx-reader -m sweetreaction example.js
Basically, the sweetreaction
npm module has the exported macros, use it with your usual Sweet.js setup.
Example
mixin SetIntervalMixin { thisintervals = ; } { thisintervals; } { thisintervals; } component TickTock uses SetIntervalMixin initialState seconds: 0 defaultProps name: "React" { this; // Call a method on the mixin } { this; } render thisunit = 'seconds'; <p> thispropsname has been running for thisstateseconds thisunit </p> statics { return n + 1; } mount <TickTock /> to document;
compiles to:
var SetIntervalMixin = { thisintervals = ; } { thisintervals; } { thisintervals; };var TickTock = React;React;
License
Copyright © 2014 myfreeweb This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.