Creating the CollectionControls component
Now, when we understand what the Collection
component renders, let's discuss its child components. We'll start with CollectionControls
. Create the following ~/snapterest/source/components/CollectionControls.react.js
file:
var React = require('react'); var Header = require('./Header.react'); var Button = require('./Button.react'); var CollectionRenameForm = require('./CollectionRenameForm.react'); var CollectionExportForm = require('./CollectionExportForm.react'); var CollectionControls = React.createClass({ getInitialState: function () { return { name: 'new', isEditingName: false }; }, getHeaderText: function () { var numberOfTweetsInCollection = this.props.numberOfTweetsInCollection; var text = numberOfTweetsInCollection; ...
Get React: Building Modern Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.