Refactoring the Application component
Where do we start refactoring our React components? Let's start with the uppermost React component in our components hierarchy, Application
.
At the moment, our Application
component stores and manages the collection of tweets. Let's remove this functionality, as it's now managed by the collection store. Remove the getInitialState()
, addTweetToCollection()
, removeTweetFromCollection()
, and removeAllTweetsFromCollection()
methods from the Application
component:
var React = require('react'); var Stream = require('./Stream.react'); var Collection = require('./Collection.react'); var Application = React.createClass({ render: function () { return ( <div className="container-fluid"> <div className="row"> <div className="col-md-4 ...
Get React.js Essentials 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.