August 2017
Beginner
374 pages
10h 41m
English
We have already implemented this container component, so we can use the existing code. However, we still need to implement the filter functionality:
import { connect } from 'react-redux'
import PostList from '../components/PostList.jsx'
const mapStateToProps = (state, props) => {
return { posts: state.posts }
}
const ConnectedPostList = connect(mapStateToProps)(PostList)
export default ConnectedPostList
const mapStateToProps = (state, props) => { const filteredPosts = state.filter ? state.posts.filter((post) => post.category === state.filter) ...Read now
Unlock full access