General documentation / cheat sheets for various languages and services

React

React.PropTypes

Source: React documentation

Unless modified by .isRequired, all types are optional.

When using class components, it looks like this:

class NameValuePair extends React.Component { render() { ... } static propTypes = { name: React.PropTypes.string.isRequired, value: React.PropTypes.any.isRequired, } }

For complex hierarchical types, types can be nested:

import {PropTypes, Component} from 'react'; const AuthorPropTypes = { first: PropTypes.string, middle: PropTypes.string, last: PropTypes.string.isRequired, }; const ReferencePropTypes = { authors: PropTypes.arrayOf(PropTypes.shape(AuthorPropTypes)).isRequired, year: PropTypes.string.isRequired, title: PropTypes.string.isRequired, }; class Reference extends Component { render() { ... } static propTypes = ReferencePropTypes }

Primitives

Complex types

Component Lifecycle

Sources: Component Specs and Lifecycle, ES6 Classes, and comment in source.