React Dom not updating after updating a state array

so this function updates this state array:
let [Produits, setProduit] = useState(JSON.parse(Devis.produits))

 let changeQte = (id, e) => {
    let produittable = Produits;
    produittable.forEach((p) => {
      if (p.id == id) {
        p.quantityAchete = parseInt(e.target.value);
      }
    });
    setProduit(produittable);  
  };

the array did update without any problem but the changes aren’t getting re-rendered

  {console.log('rendering') ,Produits.map((p) => (
            <div key={p.id} className="product_column flex_center">
              <div className="productItem">{p.nom}</div>
              <div className="productItem">{p.category}</div>
              <div className="productItem">{p.prix_vente} DA</div>
              <input
                onChange={(e) => changeQte(p.id, e)}
                type="number"
                name="qte"
                value={p.quantityAchete}
              />

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 !

200 thoughts on “React Dom not updating after updating a state array”

  1. Pingback: is quinoa keto
  2. hi!,I like your writing very much! share we
    keep up a correspondence extra approximately your post on AOL?
    I require an expert on this house to solve my problem.
    May be that is you! Taking a look ahead to peer you.

    Reply
  3. Thank you a bunch for sharing this with all people you really realize what you’re talking approximately!
    Bookmarked. Kindly also talk over with my web site =).

    We could have a link trade agreement between us

    Reply
  4. Terrific work! This is the type of information that are
    supposed to be shared across the internet. Disgrace on the seek engines for now not
    positioning this post higher! Come on over
    and talk over with my web site . Thanks =)

    Reply