React
React
⇒
a abbr address area article aside audio b base bdi
Create a component class, given a specification. A component
React.createClass( ReactComponent|Specification , CALLBACK? ) ReactClass implements a render method which returns one single child.
bdo big blockquote body br button canvas caption
cite code col colgroup data datalist dd del details
↳ let ExampleComponent = React.createClass({render: () => <div>Hi</div>}) OR ExampleComponent extends React.Component {...} dfn dialog div dl dt em embed fieldset figcaption
figure footer form h1 h2 h3 h4 h5 h6 head header
React.createElement( HTMLTag String|ReactClass , {PROPS}? , [CHILDREN...]? ) ⇒ ReactElement Create and return a new ReactElement of the given type.
hgroup hr html i iframe img input ins kbd keygen
label legend li link main map mark menu menuitem
meta meter nav noscript object ol optgroup option
⇒
draggable encType form formAction formEncType
If this component has been mounted into the DOM, this returns the
ReactDOM.findDOMNode( ReactComponent ) DOMElement corresponding native browser DOM element.
formMethod formNoValidate formTarget frameBorder
headers height hidden high href hrefLang htmlFor
⇒ Remove a mounted React component from the DOM and clean up httpEquiv icon id inputMode integrity is keyParams
ReactDOM.unmountComponentAtNode( ReactComponent ) Boolean its event handlers and state.
keyType kind label lang list loop low manifest
marginHeight marginWidth max maxLength media
mediaGroup method min minLength multiple muted
import ReactDOMServer from 'react-dom/server' name noValidate nonce open optimum pattern
placeholder poster preload radioGroup readOnly rel
ReactDOMServer.renderToString( ReactElement ) ⇒ String Render a ReactElement to its initial HTML. required reversed role rowSpan rows sandbox scope
scoped scrolling seamless selected shape size sizes
span spellCheck src srcDoc srcLang srcSet start step
ReactDOMServer.renderToStaticMarkup( ReactElement ) ⇒ String
Similar to renderToString, except this doesn't create extra DOM
attributes such as data-react-id, that React uses internally.
style summary tabIndex target title type useMap
value width wmode wrap
Component API ExampleComponent extends React.Component {...} RDFa: about datatype inlist prefix property resource
typeof vocab
render() ⇒ ReactElement|void|null
A pure function that returns a ReactElement which relies upon SVG Attributes
CORE
void after the initial rendering occurs. xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType
xmlBase xmlLang xmlSpace y1 y2 y
componentWillReceiveProps() ⇒ NextPropsObject
Invoked when a component is receiving new props. This method is
not called for the initial render.
componentWillUnmount() ⇒ void
Invoked immediately before a component is unmounted from the
DOM.
React Cheat Sheet (0.14.7) JSX Events
PAGE 2 Synthetic Event (default callback arg)
{
Boolean bubbles
Component API (cont'd) Boolean cancelable
DOMEventTarget currentTarget
NON-DOM TAGS
Boolean defaultPrevented
Number eventPhase
key <ExampleComponent key="uniqueValue" /> An optional, unique identifier. When your component shuffles
around during render passes, it might be destroyed and recreated Boolean isTrusted
DOMEvent nativeEvent
ref <ExampleComponent ref={ String|Callback } /> Reference to the React Component. ReactDOM.FindDOMNode(ref).
If a callback is used, the component will be passed to the function. void preventDefault()
Boolean isDefaultPrevented()
dangerouslySetInnerHTML <span dangerouslySetInnerHTML={ __HTML: String } /> Provides the ability to insert raw HTML, mainly for cooperating with
DOM string manipulation libraries.
void stopPropagation()
Boolean isPropagationStopped()
USEFUL PROPERTIES AND FEATURES DOMEventTarget target
Number timeStamp
String type
this.props.children <Component>{this.props.children}</Component> Will contain any nested children passed in from the parent
component. }
Clipboard
...
onCopy onCut onPaste
<ExampleComponent {...this.props} /> The Spread Operator (...) can be used to extract the entirety of an
object without the need to define every key. ( DOMDataTransfer clipboardData )
Stateless Syntax var HelloMsg = <div>Hello {props.name}</div> This defines a stateless component. Can
ReactDOM.render(<HelloMsg name="John" />.
Composition onCompositionEnd
onCompositionStart onCompositionUpdate
( String data )
PROPERTIES
Keyboard onKeyDown onKeyPress onKeyUp
This object defines the initial props values. It is cached and invoked ( Boolean altKey, Number charCode, Boolean
ReactComponentClass.defaultProps = DefaultPropertiesObject once when a class is instantiated. ctrlKey, Boolean getModifierState(key), String key,
Number keyCode, String locale, Number location,
The PropertiesSpecificationObject defines the contract a parent Boolean metaKey, Boolean repeat, Boolean
ReactComponentClass.propTypes = PropertiesSpecificationObject component must comply with when providing properties.
shiftKey, Number which )
↳ The PropertiesSpecificationObject can define the following property types (they are optional by default): Focus onFocus onBlur
→→ React.PropTypes.array ( DOMEventTarget relatedTarget )
→→ React.PropTypes.bool
→→ React.PropTypes.func
Form onChange onInput onSubmit