Refactoring the Application component
Where do we start refactoring our React components? Let’s start with our topmost 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 constructor()
, addTweetToCollection()
, removeTweetFromCollection()
, and removeAllTweetsFromCollection()
methods from the Application
component:
import React from ‘react’; import Stream from ‘./Stream’; import Collection from ‘./Collection’; class Application extends React.Component { render() { const { collectionTweets } = this.state; return ( <div className="container-fluid"> <div className="row"> <div className="col-md-4 text-center"> <Stream onAddTweetToCollection={this.addTweetToCollection...