Skip to content

Commit

Permalink
real world example
Browse files Browse the repository at this point in the history
  • Loading branch information
winstonewert committed Jan 7, 2016
1 parent 1d8af17 commit 8c40262
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/real-world/containers/UserPage.js
@@ -1,5 +1,6 @@
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import connect from './connect'
import {dataReactions, fetchUser, fetchStarred} from '../reactions/data'
import { fetchMoreStarred } from '../actions'
import User from '../components/User'
import Repo from '../components/Repo'
Expand Down Expand Up @@ -75,6 +76,16 @@ function mapStateToProps(state) {
}
}

function reactions(state) {
const { login } = state.router.params
const {
pagination: { starredByUser },
entities: { users, repos }
} = state
console.log("Hello");
return dataReactions(login, entities, pagination, ['name'], fetchUser, fetchStarred);
}

export default connect(mapStateToProps, {
fetchMoreStarred
})(UserPage)
}, reactions)(UserPage)
12 changes: 12 additions & 0 deletions examples/real-world/reactions/index.js
Expand Up @@ -86,6 +86,18 @@ function fetchPaginatedData(id, paginations, actionCreator) {
}

export function reactions(state) {
var x = _(state.router.components)
.map('reactions')
.filter() // remove components that don't have a reactions function.
.transform((t) => {console.log("X", t);t(state)})
.flatten()
.value();
console.log(x);

return [];
}

function old() {
var {login, name} = state.router.params;
var repo = (login && name) ? `${login}/${name}` : undefined;
return [
Expand Down

0 comments on commit 8c40262

Please sign in to comment.