Skip to content
Advertisement

Tag: prism-react-renderer

React Dom not updating after updating a state array

so this function updates this state array: let [Produits, setProduit] = useState(JSON.parse(Devis.produits)) the array did update without any problem but the changes aren’t getting re-rendered as you can see i’m loggin to the console to check if that line is getting executed and it does ! but the values rendered doesn’t update ! Answer Don’t mutate state, do this instead:

Advertisement