Redux subscribe listener

Hello campers
I am creating an App using react-redux and react router , I want to fire a function in a module called sideBar.js by using subscribe where I am also using HOC to add some features to this component.
the problem is that this function works very well when I put it in the root component , but in sideBar component it is not working I don’t know why !!
could any one please help me .

You need to post some code, ideally putting the full the [non]working version up somewhere like stackblitz: we cannot see what is in front of you so it’s impossible to give you an answer based on the short description.

here is the source code

I’m not sure what the issue is? What you have seems to be working. But I have a couple questions / observations.

  1. Why the HOC? It is not imported from elsewhere or used anywhere else, and isn’t anything you couldn’t have just included in the component, so not sure what the point of it is?
  2. You really should never call this.setState in componentDidUpdate, unless your checking some condition. Right now you add a coffee and it may not appear as if it is, but you have a infinate loop going on.
  3. I’m assuming you mean to show this breifly then hide it, which could be accomplished from the component showing it to begin with.
  4. I’m fairly certain you have coffee misspelled in several places.

Maybe you already figured out the issue you where mentioning before, but figured i’d point these out.

Thanks for your notice, I used HOC to give to the one list in the component different colors every time I click on a coffe ,
I think I can accomplish that without HOC but I am using it only for the practice ,
for componentDidUpdate there is infinite loop but it is not appear to me in the console , but what I want to acheive is what you said in the 3 observation is to show that right box breifly and hide it , and I want to use setTimeout to change className from show by default to hide
without clicking ,it should do that automatically and when I click again on a coffe it should appear and after period of time should disappear .