Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.
function foo ({
bar = 'no',
baz = 'works!'
} = {}) {
'use strict'; | |
module.exports = function CustomError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
This is a proposal for a lightning talk at the Reactive 2015 conference.
NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!
Relay makes data fetching in React apps simpler, by letting you declare the data needs of your components instead of writing complex imperative code. React, Relay, GraphQL and the other complementary tools are changing how apps are built.
function main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
}; | |
} | |
const drivers = { | |
DOM: function DOMDriver(sink) { | |
sink.subscribe(text => { |
function main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => { | |
return { | |
tagName: 'h1', | |
children: [`Seconds elapsed ${i}`] | |
} | |
}) | |
} |
React.createClass
, extending React.Component
and also stateless functional components.renderOnError()
in a comp