Sha256: eb24d56278ec9a161d3ce47ef389803a91a92993dc4d0afed32b492e1293c1f1
Contents?: true
Size: 1.11 KB
Versions: 20
Compression:
Stored size: 1.11 KB
Contents
// HelloWorldWidget is an arbitrary name for any "dumb" component. We do not recommend suffixing // all your dump component names with Widget. import React, { PropTypes } from 'react'; // Simple example of a React "dumb" component export default class HelloWorldWidget extends React.Component { static propTypes = { // If you have lots of data or action properties, you should consider grouping them by // passing two properties: "data" and "actions". updateName: PropTypes.func.isRequired, name: PropTypes.string.isRequired, }; // React will automatically provide us with the event `e` handleChange(e) { const name = e.target.value; this.props.updateName(name); } render() { const { name } = this.props; return ( <div className="container"> <h3> Hello, {name}! </h3> <hr /> <form className="form-horizontal"> <label> Say hello to: </label> <input type="text" value={name} onChange={e => this.handleChange(e)} /> </form> </div> ); } }
Version data entries
20 entries across 20 versions & 1 rubygems