Passing data from one state to another state in react

const [object, setObject] = useState({
        id: null,
        created_date: "2021-02-18",
        classroom:"",
        name: "",
});

i want to pass the create_date value to anther state

const [notify, setNotify] = useState({
        id: 5,
        created_by: "1",
        notification:"object added",
        received_date:created_date,
});

here, i want that created_date value in received_date

25 thoughts on “Passing data from one state to another state in react”

Leave a Comment