O'Reilly logo

React.js Essentials by Artemij Fedosejev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the CollectionRenameForm component

First, let's create the ~/snapterest/source/components/CollectionRenameForm.react.js file:

var React = require('react'); var ReactDOM = require('react-dom'); var Header = require('./Header.react'); var Button = require('./Button.react'); var inputStyle = { marginRight: '5px' }; var CollectionRenameForm = React.createClass({ getInitialState: function() { return { inputValue: this.props.name }; }, setInputValue: function (inputValue) { this.setState({ inputValue: inputValue }); }, handleInputValueChange: function (event) { var inputValue = event.target.value; this.setInputValue(inputValue); }, handleFormSubmit: function (event) { event.preventDefault(); var collectionName = this.state.inputValue; this.props.onChangeCollectionName(collectionName); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required