React queue simulation
It was some time ago since I started learning React, but for some reason I think my code has some obvious errors I can't find.
I'm trying to simulate a queue of messages in React: so, whenever you submit a message to the queue, it shows a message of submitting plus a cancel button so you can cancel the message from "submit".
But there is a bug: the state of msgQueue is set to a an empty array in the re-render, like if it was the first render: I think it is executing the:
line in the beginning of the component, and I don't know why.
Any help would be apreciated.
2 Replies