import React, { useState } from "react";
import Form from "./child/form.js";
import Details from "./child/details.js";
function App() {
const [inp, modifyInp] = useState([]);
const inputHandler = (input) => {
modifyInp((prevState) => [{ ...prevState, ...input }]);
};
console.log(inp);
return (
<div>
<Form inpHandler={inputHandler} />
<Details inputt={inp} />
</div>
);
}
export default App;
I am trying to update state of inp here, but it is not updating properly and insted the value is being replaced. Can anyone help me with this?`