Мы используем пользовательский компонент Emotion, и в документации сказано, что те же свойства передаются клиентским компонентам, но, похоже, они не передаются. isSelected
и других свойств там тоже нет.
const Option = styled.div`
color: #444;
font-family: 'Open Sans', 'Arial', Sans-Serif !important;
font-size: 0.6875rem;
text-indent: 6px;
line-height: 1.85;
&:hover {
background: #9cbac2;
}
${props => {
return css`
background: ${props.isSelected ? 'red' : '#eee'}; // props.isSelected is not defined
`;
}}
`;
<Select
components={{
Option: ({ children, innerProps, innerRef }) => (
<Option ref={innerRef} {...innerProps}>
{children}
</Option>
),
}}
styles={reactSelectStyles} // Tried styling Option in the styles object, but that didn't work with a custom component
/>