- plain ol' React
let state = initial
render(view(state), element)
view
is pure!
if (typeof Promise === 'undefined') { | |
require.ensure([], (require) => { | |
require('imports?this=>window!es6-promise') | |
}) | |
} | |
if (typeof fetch === 'undefined') { | |
require.ensure([], (require) => { | |
require('imports?self=>window!whatwg-fetch') | |
}) |
/* | |
* Load external modules and init variables | |
*/ | |
var twitter = require('ntwitter'), | |
http = require('http'), | |
bitly = require('bitly'), | |
b = new bitly('USER', 'API_KEY'), | |
tweeted = {}, | |
load_time = Math.round(new Date().getTime() / 1000), | |
score_threshold = 100; |
import React from 'react' | |
import warning from 'warning' | |
const { number, object } = React.PropTypes | |
const WindowScrollTo = React.createClass({ | |
contextTypes: { | |
windowScrollTo: object | |
}, |
// In v2/3 you did this: | |
import ReactDOM from 'react-dom' | |
import { Router, browserHistory, Route } from 'react-router' | |
ReactDOM.render( | |
<Router> | |
<Route path="/about" component={About}/> | |
<Route path="/:username" component={User}/> | |
</Router> | |
) |
/** Use the built-in document viewer in devtools to inspect your VDOM. | |
* Usage in console: | |
* viewComponentTree(document.body) | |
*/ | |
function viewComponentTree(node) { | |
let doc = new DOMParser().parseFromString('', 'application/xml'); | |
function visitor(dom) { | |
let el, c; | |
if (dom instanceof Node) { | |
el = dom.cloneNode(); |
/** @jsx hJSX */ | |
import {hJSX} from '@cycle/dom'; | |
const DIALOGUE_NAME = `dialogue`; | |
let idSuffix = 0; | |
function makeCycleId() { | |
return `${DIALOGUE_NAME}-${idSuffix++}`; |
type SubscribableConfig = { | |
// Maps property names of subscribable data sources (e.g. 'someObservable'), | |
// To state names for subscribed values (e.g. 'someValue'). | |
subscribablePropertiesMap: {[subscribableProperty: string]: string}, | |
// Synchronously get data for a given subscribable property. | |
// It is okay to return null if the subscribable does not support sync value reading. | |
getDataFor: (subscribable: any, propertyName: string) => any, | |
// Subscribe to a given subscribable. |
/* | |
A little node.js server for testing html5 ajax file uploads. | |
It serves up the current directory and receives uploads at /upload. | |
This is for use with xhr.send(file) where the entire request body is the file. | |
It just pauses one second between chunks so that client-side progress events | |
get a chance to fire. On my laptop it looks like the maximum chunk size is | |
around 40K, so you would still need images in the range of hundreds of kilobytes | |
to really be able to test it. |
This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf