'How can i fixed this issue

I want to update the data here through connection of Mongo db database with node.js. Database data is being updated but UI is not being updated.

#enter code here
const handleDelivered = () => {
    const newQuantity = parseInt(item?.quantity) - 1
    console.log(newQuantity)
    const url = `http://localhost:5000/items/${itemId}`
    if (item?.quantity > 0) {
        fetch(url, {
            method: 'PUT',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ quantity: newQuantity })
        })
            .then(response => response.json())
            .then(data => {
                console.log(data)
                toast("Quantity updated")
                setReload(!reload)
            })
    } else {
        toast('Opss...! Stock is empty')
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source