Комментарии:
I am a new react developer. I used
const valueName = '';
const [ state, setState ] = useState ({
[valueName]: "",
value: ""
});
and call like that
const handleChange = ({target : {name, value}}) => {
console.log( "name = " + name);
console.log( "value = " + value);
this.setState ({
[name]: value
})
};
it shows error "Uncaught TypeError: Cannot read properties of undefined (reading 'setState')". not sure how it happens
appreciate it if any suggestion.