Let's say we have this code
// Render
<List data={[1, 2, 3]} />;
function List({ data, logData }) {
return (
<ul onClick={logData}>
{/* can access data */}
{data.map(row => <li>{row}</li>)}
</ul>
);
}
export default compose(
withHandlers({
logData: props => () => {
console.log(props.data); // can’t access data
}
})
);
I'm expecting to receive the props from parent component into logData handler. Still, I'm only receiving component props.
Adding withObservable((app, props$) => props$) before withHandlers fixes it.
Is that the expected behaviour? If so, do we have another way using frint-props to access the parent props.
After some research it seems that the handler functions receive 3 params. App, props, parentProps$.
parentProps$ has access to data as per the above example. Still, as a developer I expect the compose function will compose into the handlers the component, and parent component props.
Let's say we have this code
I'm expecting to receive the props from parent component into logData handler. Still, I'm only receiving component props.
Adding withObservable((app, props$) => props$) before withHandlers fixes it.
Is that the expected behaviour? If so, do we have another way using frint-props to access the parent props.
After some research it seems that the handler functions receive 3 params. App, props, parentProps$.
parentProps$ has access to data as per the above example. Still, as a developer I expect the compose function will compose into the handlers the component, and parent component props.