import React from 'react'; import { Text } from '@uifabric/experiments'; import { Stack } from 'office-ui-fabric-react'; import { TextField, PrimaryButton } from 'office-ui-fabric-react'; import { Store } from '../store'; import { connect } from 'react-redux'; import { actions } from '../actions'; // TODO: after connecting to view, erase the ?'s interface TodoHeaderProps { addTodo?: (label: string) => void; } interface TodoHeaderState { labelInput: string; } export class TodoHeader extends React.Component { constructor(props: TodoHeaderProps) { super(props); this.state = { labelInput: undefined }; } render() { return ( todos Add ); } private onAdd = () => { this.props.addTodo(this.state.labelInput); this.setState({ labelInput: undefined }); }; private onChange = (evt: React.FormEvent, newValue: string) => { this.setState({ labelInput: newValue }); }; } /* TODO: uncomment the following and fill out the TODO's function mapStateToProps(state: Store) { // TODO: fill this out } function mapDispatchToProps(dispatch: any) { // TODO: fill this out } const component = connect( mapStateToProps, mapDispatchToProps )(TodoHeader); export { component as TodoHeader }; */