Skip to content

Commit dc66bd8

Browse files
committed
Add the react unmount
1 parent 5d571f8 commit dc66bd8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/cart/cart-item.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const CartItem = ( {
1515
const productImg = item?.data?.images?.[0] ?? '';
1616

1717
/**
18+
* Do not allow state update on an unmounted component.
19+
*
1820
* isMounted is used so that we can set it's value to false
1921
* when the component is unmounted.
2022
* This is done so that setState ( e.g setRemovingProduct ) in asynchronous calls

0 commit comments

Comments
 (0)