I'm new to REACT and I'm having trouble trying to figure out not only the onChange event props, but many of the others. Its the props being passed in thats getting me. eg
handleSubmit(e) {
let s = this.state;
s.data[e.target.name] = e.target.value;
this.setState(s);
}
its given like this in pretty much all the examples I have seen (the declaration of the function) and always complains about e in the function def as being implicitly an 'any' type. If I declare it as e:any it stops complaining, but then I cant get the s.data[e.target.name] to work as it says I cant have an 'any' type as an index. I cant figure out how it's meant to be declared, or if I have a configuration issue somewhere. It works if I replace e.target.name with a string constant like 'myarray'.
The REACT app was generated with a plain
npx create-react-app test --template typescript
with no changes to the generated configuration files.
The state was declared as
state = {
data: { fldName: 'something', anotherField: 'somethingelse'}
}
Any ideas ?