Dear @mroderick ,
Thanks for this awesome library 👍 .
I'm facing one issue using publish method:
I'm using publish method on button click, to add the item in cart:
<Button onClick={() => { PubSub.publish("ADD_TO_CART", card); }} > Add to cart </Button>
and I'm listing this in another component:
PubSub.subscribe("ADD_TO_CART", function (msg, data) { console.log(data); });
but problem is, when I clicked 3-4 times on the same button, the listener prints all previous value and new value as well. is there any way to publish only latest value not the past values??
Thanks in advance!
Dear @mroderick ,
Thanks for this awesome library 👍 .
I'm facing one issue using
publishmethod:I'm using publish method on button click, to add the item in cart:
<Button onClick={() => { PubSub.publish("ADD_TO_CART", card); }} > Add to cart </Button>and I'm listing this in another component:
PubSub.subscribe("ADD_TO_CART", function (msg, data) { console.log(data); });but problem is, when I clicked 3-4 times on the same button, the listener prints all previous value and new value as well. is there any way to publish only latest value not the past values??
Thanks in advance!