A
A
Alexandroppolus2020-11-05 12:42:07
React
Alexandroppolus, 2020-11-05 12:42:07

Styled-components and NOT className - what to do?

Hello everyone.
I have a React library component that accepts className and calendarClassName props, the latter will be used for some detail of this component.
styled-components makes it easy to spud className, but what about the calendar?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wondermarin, 2020-11-05
@Alexandroppolus

const BaseComponent = styled.div`
  color: black;
`;

const Component = styled(({ className, ...props }) => <BaseComponent calendarClassName={className} {...props} />)`
  color: white;
`;

Styles in BaseComponentpropagate to className.
Styles in Componenton calendarClassName.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question