infer parameters of function passed as prop on a react component
is there any way to infer the parameters values of a function passed with props?
I am trying to create a like button that raises an event once the user clicks on it, the like component only call the function passes via props and i handle the click on the main component.
The problem is that in the like component i should pass the person object but i cant because i dont know about it, its passes as argument of the callback (onLike)
5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i could but the like button would not be reusable
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You can also just make "onLike" an onClick with no params. Since you're using a function already "handle like" that takes in the person already