When a Stock that has Flows is deleted, the associated Flows in React are not removed even though Firebase did remove them.
This is because the useState is async. useState will be called with a new set of Flows. But at the same time, another useState for Stocks is called and it has the old set of Flows. This overwrites the new set of Flows.
When a Stock that has Flows is deleted, the associated Flows in React are not removed even though Firebase did remove them.
This is because the useState is async. useState will be called with a new set of Flows. But at the same time, another useState for Stocks is called and it has the old set of Flows. This overwrites the new set of Flows.