AllenFang / react-bootstrap-table

A Bootstrap table built with React.js
https://allenfang.github.io/react-bootstrap-table/
MIT License
2.24k stars 783 forks source link

Is there a way where onClick + button increase the counter of that particular row only not all the rows? #2093

Open dashName opened 4 years ago

dashName commented 4 years ago

I am trying something like below but it updates all the row: const dataFormatter = (cell, row, rowIndex,formatExtraData) => { return (

addToCart(rowIndex)}>
                <div  style={{backgroundColor: '#fff', padding: '2px 5px',outline:'none'}}> {formatExtraData}</div>
                <div onClick={() => removeFromCart(rowIndex)}><img src={minus} style={{backgroundColor: '#2a4252'}}/></div>
            </div>
        );
    };
dashName commented 4 years ago
Screen Shot 2019-10-08 at 11 18 20 AM