Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Build Applications with Meteor

You're reading from   Build Applications with Meteor Isomorphic JavaScript web development

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781787129887
Length 388 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dobrin Ganev Dobrin Ganev
Author Profile Icon Dobrin Ganev
Dobrin Ganev
Arrow right icon
View More author details
Toc

Connecting the Redux store with the React components


Throughout the book, we have been splitting the components into presentational and container components. There are a few things that we can do with Redux by following that pattern.

The presentational components will not be aware of Redux, and their main job is to present the UI. All markup and CSS classes will be defined in the presentational components. On the other hand, the containers will take care of the data and will barely contain any markup. The main difference is that we will have Redux to generate the containers for us.

Redux is not a React library, and we can get the bindings from the react-redux library:

import {connect} from 'react-redux'
class Tweets extends React.Component {
  ...
}

const mapStateToProps = (state) => ({tweets: state.tweets, filters: state.filters})
export default connect(mapStateToProps)(Tweets)

Here's how it works:

  • We imported the connect method from react-redux and mapped the global state values with the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images