2018-12-05 00:49:33 +02:00
|
|
|
import React from 'react';
|
|
|
|
import {connect} from 'react-redux';
|
2018-12-01 19:22:26 +05:30
|
|
|
import testAction from '../actions/test';
|
2018-12-01 21:40:41 +05:30
|
|
|
import fetchVideos from '../actions/fetchVideos';
|
2018-12-05 21:48:08 +02:00
|
|
|
import Search from '../components/Search';
|
|
|
|
import Footer from '../components/Footer';
|
|
|
|
import RandomLocation from "../components/RandomLocation";
|
|
|
|
import RandomDate from "../components/RandomDate";
|
|
|
|
import RandomTopic from "../components/RandomTopic";
|
|
|
|
import Header from "../components/Header";
|
2018-12-01 19:22:26 +05:30
|
|
|
class Home extends React.Component {
|
|
|
|
clickBtn() {
|
|
|
|
this.props.testAction('some new value');
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
2018-12-05 00:49:33 +02:00
|
|
|
<RandomTopic/>
|
|
|
|
<RandomLocation/>
|
|
|
|
<RandomDate/>
|
2018-12-01 19:22:26 +05:30
|
|
|
</div>
|
|
|
|
);
|
2018-12-05 00:49:33 +02:00
|
|
|
//
|
|
|
|
// <div>
|
|
|
|
// This is home. {this.props.test}
|
|
|
|
// <div>
|
|
|
|
// <Link to="/topics">Go to topics</Link>
|
|
|
|
// </div>
|
|
|
|
// <div>
|
|
|
|
// <button onClick={this.clickBtn.bind(this)}>Click me</button>
|
|
|
|
// <button onClick={this.props.fetchVideos}>Fetch videos</button>
|
|
|
|
// </div>
|
|
|
|
// <div>
|
|
|
|
// {this.props.loading && 'Loading...'}
|
|
|
|
// {this.props.videos.map(video => {
|
|
|
|
// return (<div key={video.id}>{video.title}</div>);
|
|
|
|
// })}
|
|
|
|
// </div>
|
|
|
|
// </div>
|
2018-12-01 19:22:26 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
2018-12-01 21:40:41 +05:30
|
|
|
test: state.home.test,
|
|
|
|
loading: state.home.loading,
|
|
|
|
videos: state.home.videos
|
2018-12-01 19:22:26 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
2018-12-01 21:40:41 +05:30
|
|
|
testAction: value => dispatch(testAction(value)),
|
|
|
|
fetchVideos: () => dispatch(fetchVideos())
|
2018-12-01 19:22:26 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Home);
|