We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports all the native browser events, but provides a consistent API on all browsers
class ClickExample extends Component { constructor(props) { super(props); this.state = {name: "tim"}; this.handleClick = this.handleClick.bind(this); } handleClick(e) { this.setState((prevState, props) => ({ name: prevState.name.toUpperCase() }); } render() { return ( <div> <p>{this.state.name}</p> <button type="button" onClick={this.handleClick}> UPPERCASE </button> </div> ); } }
render() { return ( <div> <p>{this.state.name}</p> <button type="button" onClick={() => this.setState({name: "TIM"})}> UPPERCASE </button> </div> ); }
<form onSubmit={(e) => { e.preventDefault(); const data = [...this.state.data, this.state.inputText]; this.setState({data, inputText: ''}); }}> <input type="text" name="inputText" value={this.state.inputText} onChange={(e) => { this.setState({[e.target.name]: e.target.value}) }} /> </form>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Virtual DOM
Synthetic Events
Supports all the native browser events, but provides a consistent API on all browsers
Events
bond function
inline calbacks
Form
refs
Use Cases
The text was updated successfully, but these errors were encountered: