Sha256: a4a945457fa890d353c4cc12d7bdc809c61cf78506623423235f6d7eea1b69f8
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
import React, { PropTypes } from 'react'; import HelloWorld from '../components/HelloWorld'; // Simple example of a React "smart" component export default class HelloWorldContainer extends React.Component { static propTypes = { name: PropTypes.string.isRequired, // this is passed from the Rails view }; constructor(props) { super(props); // How to set initial state in ES6 class syntax // https://facebook.github.io/react/docs/reusable-components.html#es6-classes this.state = { name: this.props.name }; } updateName = (name) => { this.setState({ name }); }; render() { return ( <div> <HelloWorld name={this.state.name} updateName={this.updateName} /> </div> ); } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
react_on_rails-6.2.1.rc.1 | lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorldContainer.jsx |