This questions may already exist, if so link off to it and I can close this. Could not find an answer or proper phrasing.
I want to pass a value to the function that will be sent into my component. For example, I want to do the same as what an event handler does. Except that I want to be passing the value (ie the event obj or in my case and id).
const Foo = ({ onSort }) => {
return <Bar onSort={ onSort } />;
Lets say the contract for onSort
is (a: Array<T>, b: Array<T>, id?: string)
. I am not sure that this how the function contract should be but I want to be the one passing the id
into the onSort
that is given as prop to Bar
. Hope that makes sense.
Do I just wrap it and send it in? But that would just call it no?