(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /** @jsx React.DOM */ | |
| var Graphic = React.createClass({ | |
| componentDidMount: function() { | |
| var context = this.getDOMNode().getContext('2d'); | |
| this.paint(context); | |
| }, | |
| componentDidUpdate: function() { |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
| /* Sources: | |
| * http://reference.sitepoint.com/css | |
| * http://developer.mozilla.org/en/CSS | |
| * https://github.com/peteboere/css-crush/blob/master/misc/initial-values.ini */ | |
| .default-values { | |
| animation : none; | |
| animation-delay : 0; | |
| animation-direction : normal; | |
| animation-duration : 0; |
| -------------------------- | |
| -- CORE LIBRARY IMPORTS -- | |
| -------------------------- | |
| import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn) | |
| import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2) | |
| import Signal exposing (Signal, Mailbox, mailbox, send) | |
| import List | |
| --------------------------------- | |
| -- THIRD PARTY LIBRARY IMPORTS -- |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |