I will start by saying: I know that this question have been asked several times here on the site.
I'm still asking because not all of the errors i found matched mine, and all of them didn't stem from the same reasons, so at the end of it, i still remained with no clue for any solution.
Now, for the problem itself:
I have a React app, and i have this object:
let Ellipse = {
radii: ['', ''],
coordinates: ['', ''],
tilt: ['']
}
The object is defined outside the main function, which means that the program looks something like this:
let Ellipse = {
radii: ['', ''],
coordinates: ['', ''],
tilt: ['']
}
export default function App() {
const handleForm = (e) => {
Ellipse.coordinates[0] = parseInt(e.target.value);
}
return (
<TextField required onChange={handleForm}/>
);}
The problem is that on the first time when i try to wirte something on the textfield everything is fine, but on the second time it's just getting freaked out, and the console (on the chrome dev tools) is coming out with the error that i've mentioned in the title:
Uncaught TypeError: Cannot assign to read only property '0' of object '[object Array]'
PLS HELP!