Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { connect } from 'react-redux'
  3. import actions from '../../actions'
  4.  
  5. class Feeds extends Component{
  6.  
  7. componentDidMount(){
  8. this.props.fetchFeeds(null)
  9. }
  10.  
  11. render(){
  12. return(
  13. <ul>
  14. {
  15. this.props.feed.all.map((feed, i)=>{
  16. return (
  17. <li key={i}><a href="#">{feed.name}</a></li>
  18. )
  19. })
  20. }
  21. </ul>
  22. )
  23. }
  24. }
  25.  
  26. const stateToProps = (state) => {
  27. return {
  28. feed: state.feed
  29. }
  30. }
  31.  
  32. const dispatchToProps = (dispatch) => {
  33. return {
  34. fetchFeeds: (params) => dispatch(actions.fetchFeeds(params))
  35. }
  36. }
  37.  
  38. export default connect(stateToProps, dispatchToProps)(Feeds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement