In React's terminology, there are five core types that are important to distinguish:
React Elements
| /* | |
| * Minimal classList shim for IE 9 | |
| * By Devon Govett | |
| * MIT LICENSE | |
| */ | |
| if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') { | |
| Object.defineProperty(HTMLElement.prototype, 'classList', { | |
| get: function() { |
| /* | |
| * 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. | |
| */ | |
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { |
| var copyProperties = require('react/lib/copyProperties'), | |
| Dispatcher = require('flux').Dispatcher, | |
| util = require('util'); | |
| function AppDispatcher() { | |
| Dispatcher.call(this); | |
| this._queue = []; | |
| } | |
| util.inherits(AppDispatcher, Dispatcher); |
In React's terminology, there are five core types that are important to distinguish:
React Elements
While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.
Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.
lib/ is intended for code that can run as-issrc/ is intended for code that needs to be manipulated before it can be used| // Hello. There is now a module for this. | |
| // https://github.com/0x8890/error-class | |
| // $ npm install error-class | |
| const hasCaptureStackTrace = 'captureStackTrace' in Error | |
| // Internal function to set up an error. | |
| function setup (message) { | |
| const { constructor, constructor: { name } } = this |
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() { |
NOTE I'm trying to find the most optimal fav/touch icon setup for my use-cases. Nothing new here. Read Mathias Bynens' articles on re-shortcut-icon and touch icons, a FAQ or a Cheat Sheet for all the details.
I'd like to hear how you approach this: @valuedstandards or comment on this gist.
You have to include a boatload of link elements pointing to many different images to provide (mobile) devices with a 'favicon' or 'touch icon':
| /* @flow */ | |
| type State = Object | |
| type Action = {type: string | void} | |
| type AsyncAction = (performAction: FluxPerformFunction, state: State) => void | |
| type ActionCreator = () => Action | AsyncAction | |
| type StoreFunction = (state: State, action: Action) => State |