Thank Kushan 👍, That's a great way to abstract the click state functionality.
I love how each Child component gets to track its own clicked state (after wrapping it with AddClick HoC).
AddClick
I've also gotten a feedback on Reddit and how someone already created a library react-on-off for such a scenario.
I believe that your HoC version is handy when good-enough is just good enough.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank Kushan 👍,
That's a great way to abstract the click state functionality.
I love how each Child component gets to track its own clicked state (after wrapping it with
AddClick
HoC).I've also gotten a feedback on Reddit and how someone already created a library react-on-off for such a scenario.
I believe that your HoC version is handy when good-enough is just good enough.