diff --git a/src/App.tsx b/src/App.tsx index ace1792..2d91b12 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import 'milligram'; import 'normalize.css'; -import React, { ChangeEventHandler, Component, MouseEventHandler } from 'react'; +import React, { ChangeEvent, Component, MouseEventHandler } from 'react'; import { DragDropContext, Draggable, @@ -209,7 +209,8 @@ export class App extends Component { > @@ -236,9 +237,9 @@ export class App extends Component { > { > { }); } - private changeMargin: ChangeEventHandler = e => - this.setState({ marginInput: e.target.value }) - - private changeSpacing: ChangeEventHandler = e => - this.setState({ spacingInput: e.target.value }) - - private changeUrl: ChangeEventHandler = e => - this.setState({ remoteUrl: e.target.value }) + private changeInput = ( + e: ChangeEvent, + ) => { + const newState: { [P in T]: State[P] } = { [e.target.id]: e.target.value }; + this.setState(newState); + } private clear: MouseEventHandler = () => { this.setState({