Home > Software design >  Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop.&qu
Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop.&qu

Time:03-08

This is my component :

import React, { useState } from "react";

const Product = () => {
    const [count, setCount] = useState(0);
    return ( 
        <>
        <span className="m-2 text-info">Laptop</span>
        <span className="m-2 badge bg-primary">{format()}</span>
        <button onClick={increase()} className="m-2 btn-sm btn-success"> </button>
        <button onClick={decrease()} className="m-2 btn-sm btn-warning">-</button>
        <button onClick={delet()} className="m-2 btn-sm btn-danger">Delete           
  • Related