# react

components

elements are immutable, components may have state (when defined as classes). component objects have attributes with special meaning, these are

this.props and this.state may be update asynchronously, to use their values to calculate next state use:

this.setState({value: "some value"})
this.setState((state, props) => {value: state.value + 1})

naming conventions

inside components handlers are prefixed w/ handle, like handleChange, handleSubmit, ... handler arguments may be events (in case of native dom components) or plain data (in case of custom components). handlers given from outside via properties are prefixed w/ on, like onChange, onSubmit, ...