• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: Why is the callback function not working in the HOC component?

Resolved: Why is the callback function not working in the HOC component?

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

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 props
This is my ButtonsOur component
And this is my HOC

Answer:

The HOC isn’t reading setActive, 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!

higher-order-functions hoc javascript reactjs
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘crm.email’ doesn’t exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

02/04/2023

Resolved: Regex: Curly braces in reverse? Match X characters before a string?

02/04/2023

Resolved: build.gradle.kts task to return string

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.