Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions client/main/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
import * as React from 'react';
import { Dispatch } from "redux";
import { connect } from "react-redux";
import * as React from "react";

import {
Header,
Expand All @@ -12,34 +12,34 @@ import {
completeAll,
completeTodo,
deleteTodo
} from '../../todos';
} from "../../todos";
import { IState } from "../../todos/model";

interface AppProps {
todos: model.Todo[];
dispatch: Dispatch<{}>;
}

class App extends React.Component<AppProps> {
render() {
const { todos, dispatch } = this.props;
function App(props: AppProps) {
const { todos, dispatch } = props;

return (
<div className="todoapp">
<Header addTodo={(text: string) => dispatch(addTodo(text))} />
<MainSection
todos={todos}
editTodo={(t,s) => dispatch(editTodo(t, s))}
deleteTodo={(t: model.Todo) => dispatch(deleteTodo(t))}
completeTodo={(t: model.Todo) => dispatch(completeTodo(t))}
clearCompleted={() => dispatch(clearCompleted())}
completeAll={() => dispatch(completeAll())}/>
</div>
);
}
return (
<div className="todoapp">
<Header addTodo={(text: string) => dispatch(addTodo(text))} />
<MainSection
todos={todos}
editTodo={(t, s) => dispatch(editTodo(t, s))}
deleteTodo={(t: model.Todo) => dispatch(deleteTodo(t))}
completeTodo={(t: model.Todo) => dispatch(completeTodo(t))}
clearCompleted={() => dispatch(clearCompleted())}
completeAll={() => dispatch(completeAll())}
/>
</div>
);
}

const mapStateToProps = state => ({
todos: state.todos
const mapStateToProps = (state: IState) => ({
todos: state
});

export default connect(mapStateToProps)(App);
Loading