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

Name for props of component prop use?

Open interactivellama opened this issue 7 years ago • 0 comments

I'm starting to use a pattern like this frequently. The reason being there are multiple date-pickers in Scheduler and if you use a component instead of just another object of props you get code completion, etc. and the consuming engineer doesn't need to go look the prop up on the doc site.

Maybe it's a type of HOC pattern, because typically the Datepicker component just gets discarded by Scheduler and the props are stolen. Any naming suggestions?

"Grandfather steals from grandprops" doesn't fly off the tongue that easily. 😄

<Scheduler
  datepickerSharedProps={<Datepicker
    assistiveText={{
      openCalendar: 'Open Calendar',
      nextMonth: 'Next month',
      previousMonth: 'Previous month'
    }}
    formatter={(date) => {
      let inputText = '';
      /* Make American or the Entire Rest of the World format here. */
      if (date) {
        inputText = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
      }
      return inputText;
    }}
  />}
/>

Maybe Child Component Proxy?

interactivellama avatar Apr 28 '17 20:04 interactivellama