I\'m creating a generic function to change the state.
The error message:
TS2345: Argument of type \'() => { [x:string]: string }\' is not assignable
There are a few solutions:
this.setState({ [name]: value } as Partial)
Or
this.setState({ [name]: value } as Pick);
There is an open issue in git, take a look: cannot setState with dynamic key name type-safe