Hello everyone
I’m stuck on the state update since.
I would like when I click on the update button to update the state by changing the values 1 and 2 to 5 and 10.
import React, {useState} from "react" ;
import "./styles.css";
export default function App() {
const [state, setState] = useState({
voiture: "renault",
comment: [{score: 1, ip: "qwerty"}, {score: 2, ip: "shino"}]
})
const handleClick = () => {
setState()
}
return (
<div className="App">
{state.comment.map((item, index) => {
return( <div key={index}>{item.score}{item.ip}</div>)
})}
<button onClick={handleClick}>update</button>
</div>
);
}