Permalink
Browse files

Step 11: Hook GifsReducer into GifList component

  • Loading branch information...
samanthamichele7 committed May 31, 2017
1 parent bd88a3d commit eee1479b79cf53915d00540aa837c38c06c17fce
Showing with 18 additions and 31 deletions.
  1. +0 −15 src/components/GifsTemp.js
  2. +3 −1 src/containers/App.js
  3. +15 −15 src/reducers/gifs.js

This file was deleted.

Oops, something went wrong.
@@ -2,6 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as Actions from '../actions';
import GifList from '../components/GifList';
import SearchBar from '../components/SearchBar';
import '../styles/app.css';

@@ -10,14 +11,15 @@ class App extends React.Component {
return (
<div>
<SearchBar onTermChange={this.props.actions.requestGifs} />
<GifList gifs={ this.props.gifs } />
</div>
);
}
}

function mapStateToProps(state) {
return {
gifs: state.gifs
gifs: state.gifs.data
};
}

@@ -1,16 +1,16 @@
export default function() {
return [
{
id: 1,
url: 'http://fakeimg.pl/300/'
},
{
id: 2,
url: 'http://fakeimg.pl/300/'
},
{
id: 3,
url: 'http://fakeimg.pl/300/'
}
];
import { REQUEST_GIFS } from '../actions';

const initialState = {
data: []
};

export default function gifs(state = initialState, action) {
switch (action.type) {
case REQUEST_GIFS:
return {
...state, data: action.payload.body.data
};
default:
return state;
}
}

0 comments on commit eee1479

Please sign in to comment.