Skip to content

Commit 2264376

Browse files
committed
wire react to redux
1 parent a0b3fd5 commit 2264376

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

server/client/src/components/Dashboard.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22
import { Link } from 'react-router-dom';
3+
import SurveyList from './surveys/SurveyList';
34

45
const Dashboard = () => {
56
return (
67
<div>
7-
Dashboard
8+
<SurveyList />
89
<div className="fixed-action-btn">
910
<Link to="/surveys/new" className="btn-floating btn-large red">
1011
<i className="material-icons">add</i>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React, { Component } from 'react';
2+
import { connect } from 'react-redux';
3+
import { fetchSurveys } from '../../actions';
4+
5+
class SurveyList extends Component {
6+
componentDidMount() {
7+
this.props.fetchSurveys();
8+
}
9+
10+
render() {
11+
return (
12+
<div>
13+
SurveyList
14+
</div>
15+
);
16+
}
17+
}
18+
19+
function mapStateToProps({ surveys }) {
20+
return { surveys };
21+
}
22+
23+
export default connect(mapStateToProps, { fetchSurveys })(SurveyList);

0 commit comments

Comments
 (0)