react-trello
react-trello copied to clipboard
Add as much info as possible for props for dependency injected components
Hi, great project.
In my app, I have a different UI to create a card, which opens a modal, as so:
My initial implementation for that was to use the custom LaneFooter component, but it's actually poorly named as it's more of a CollapsibleLaneFooter, with very specific behaviour (doesn't show when lane is empty)
My second implementation was to use a custom AddCardLink component, and that worked visually, but it does not receive the laneID, so I could not create a Link with the appropriate ID in it.
In the end I managed by creating a custom AddCardLink as so:
const AddCardLink: React.FC<{ onClick: any }> = ({ onClick }) => {
useEffect(() => {
onClick();
}, []);
return <div />;
};
and then use a custom NewCardForm which does receive the laneID.
But that's really hacky overall. I would rather all custom components to receive as much data as available easily in their parent, even if your own implementation doesn't use those props.
Hi, Agree with that. Open more props to component will help