mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-30 05:23:53 +03:00
6782f4ae41
* Move extension * prettier
39 lines
938 B
JavaScript
39 lines
938 B
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
import { bindActionCreators } from 'redux';
|
|
import { connect } from 'react-redux';
|
|
import Header from '../components/Header';
|
|
import MainSection from '../components/MainSection';
|
|
import * as TodoActions from '../actions/todos';
|
|
|
|
class App extends Component {
|
|
render() {
|
|
const { todos, path, actions } = this.props;
|
|
return (
|
|
<div>
|
|
<Header addTodo={actions.addTodo} path={path} />
|
|
<MainSection todos={todos} actions={actions} />
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
App.propTypes = {
|
|
todos: PropTypes.array.isRequired,
|
|
actions: PropTypes.object.isRequired,
|
|
};
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
todos: state.todos,
|
|
path: state.router.location.pathname,
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
actions: bindActionCreators(TodoActions, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(App);
|