Added exercises

This commit is contained in:
Ken
2019-03-02 23:22:09 -08:00
parent 46b89ff90b
commit 5b14d792f8
27 changed files with 271 additions and 478 deletions
@@ -0,0 +1,24 @@
import React from 'react';
import { DefaultButton, Stack, Text } from 'office-ui-fabric-react';
import { actions } from '../actions';
import { useMappedState, useDispatch } from 'redux-react-hook';
export const TodoFooter = () => {
// TODO: make use of useMappedState(state => state) and the useDispatch functions to get
// the Redux store and dispatching actions
// HINT: const { todos } = useMappedState(...);
// HINT: useDispatch() here too.
const todos = {};
const dispatch = (...args: any[]) => {};
const itemCount = Object.keys(todos).filter(id => !todos[id].completed).length;
return (
<Stack horizontal horizontalAlign="space-between">
<Text>
{itemCount} item{itemCount === 1 ? '' : 's'} left
</Text>
<DefaultButton onClick={() => dispatch(actions.clear())}>Clear Completed</DefaultButton>
</Stack>
);
};