FICHIER index.js import React, { StrictMode } from "react"; import ReactDOM from "react-dom"; import Client from "./Refclient"; // import App from "./App"; class App extends React.Component { clientimput = React.createRef(); state = { clients: [ { id: 1, nom: "toto" }, { id: 2, nom: "tutu" }, { id: 3, nom: "titi" } ], nouveauclient: "" }; handledelete = (id) => { const clients = this.state.clients.slice(); const index = clients.findIndex((client) => client.id === id); clients.splice(index, 1); this.setState({ clients: clients }); }; handlechange = (event) => { const value = event.currentTarget.value; this.setState({ nouveauclient: value }); }; handlesubmit1 = (event) => { event.preventDefault(); const clients = this.state.clients.slice(); const nom = this.clientimput.current.value; const idun = new Date().getTime(); const client = { id: idun, nom: nom }; clients.push(client); this.setState({ clients: clients }); console.log({ idun }); }; handlesubmit2 = (event) => { event.preventDefault(); const idun = new Date().getTime(); const nom = this.state.nouveauclient; const client = { id: idun, nom: nom }; const clients = this.state.clients.slice(); clients.push(client); this.setState({ clients: clients, nouveauclient: "" }); }; render() { const title = "liste des souhaits"; const element =

Test variable

; return (

{title}

{element}
{" "}
); } } const rootElement = document.getElementById("root"); ReactDOM.render( {" "} , rootElement );