react-trello icon indicating copy to clipboard operation
react-trello copied to clipboard

Add as much info as possible for props for dependency injected components

Open johanlajili opened this issue 4 years ago • 1 comments

Hi, great project.

In my app, I have a different UI to create a card, which opens a modal, as so: image 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.

johanlajili avatar May 10 '20 15:05 johanlajili

Hi, Agree with that. Open more props to component will help

lowent avatar Jul 15 '20 14:07 lowent