Question:
I’m passing the state (setActive) to the ButtonsOur component. Further, through the callback, I pass setActive to the HOC, but I get this error “Uncaught TypeError: setActive is not a function”. Why it doesn’t work, and how i can fix this? In ButtonsOur component I am passing setActive from parent component via propsThis is my ButtonsOur component
Answer:
The HOC isn’t readingsetActive
, open
from the passed props.Also you need to pass the original props early on, and have the props in the HOC override them where necessary.
If you have better answer, please add a comment about this, thank you!