So I have a Navbar component that is rendering a number (the amount of fake money in a user’s wallet).
When they create a post in the forum component, the backend updates their wallet with 50 more money.
The Navbar still shows the old amount of money. When Navbar mounts (componentDidMount) it dispatches the action to getWallet, which makes a backend call to see the user’s wallet balance and puts it in Redux state. This works fine.
Problem is, I can’t just call getWallet over and over or it will put too many calls to the API. So how can my Navbar component be told to update it’s wallet property when a different component is modifying the wallet in Redux?
In the code, the components I am working with are in client/src
GitHub: