Minimal loader with state management capabilities.
Checkout out the demo.
Make sure to add a .babelrc file:
| //Should transform: import {Component} from 'react'; | |
| //to: const _Component = require('react').Component; | |
| export default function ({types: t}) { | |
| return { | |
| visitor: { | |
| ImportDeclaration(path) { | |
| const {node} = path; | |
| path.replaceWith( | |
| t.variableDeclaration('var', |
Minimal loader with state management capabilities.
Checkout out the demo.
Make sure to add a .babelrc file:
| const {transform} = require('babel-core') | |
| const babylon = require('babylon') | |
| const WasCreated = Symbol('WasCreated') | |
| const source = ` | |
| let b = 0 | |
| console.log(b) | |
| b = b + 2 | |
| console.log(b) |
Intended for developers interested in getting started with Flow. At the end of this introduction, you should have a solid understanding of Flow and how to apply it when building an application.
Covers all the basics needed to get started with Flow.
Covers all the basic needed to get started with Flow and ReactJS.
| class Lazy { | |
| constructor(value) { | |
| this.value = value; | |
| this.cache = null; | |
| this.isCached = false; | |
| } | |
| exec() { | |
| if (!this.isCached) { | |
| this.cache = this.value(); |
tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.
A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.
But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.
How do we solve this with React?
| # one or the other, NOT both | |
| [url "https://github"] | |
| insteadOf = git://github | |
| # or | |
| [url "git@github.com:"] | |
| insteadOf = git://github |
| console.log(1); | |
| (_ => console.log(2))(); | |
| eval('console.log(3);'); | |
| console.log.call(null, 4); | |
| console.log.apply(null, [5]); | |
| new Function('console.log(6)')(); | |
| Reflect.apply(console.log, null, [7]) | |
| Reflect.construct(function(){console.log(8)}, []); | |
| Function.prototype.apply.call(console.log, null, [9]); | |
| Function.prototype.call.call(console.log, null, 10); |
type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];| import React, { PropTypes } from "react"; | |
| import IPropTypes from "react-immutable-proptypes"; | |
| import composeEnhances from "recompose/compose"; | |
| import setDisplayName from "recompose/setDisplayName"; | |
| import setPropTypes from "recompose/setPropTypes"; | |
| import onlyUpdateForPropTypes from "recompose/onlyUpdateForPropTypes"; | |
| import { connect } from "react-redux"; |