Не удалось найти четкий пример использования функций в объектах css с styled-components
. Это не ошибка, но фон не добавляется в вывод CSS при извлечении реквизита, как в примере ниже.
// Simple color function
const color = (error) => {
if (error) {
return 'red'
}
return 'black',
}
Работает – css
const StyledInput = styled.input<InputProps>`
background: ${({ error }) => color(error)};`;
Работает – объект css
const StyledInput = styled.input<InputProps>(props => ({
background: color(), // !!! NEED error from props
}));
Не работает – объект css
const StyledInput = styled.input<InputProps>(props => ({
background: `${({ error }) => color(error)}`,
}));
Works
,Working
и т. Д. - person segFault   schedule 01.04.2020error
не установлен, мне нужно удалить его из реквизита. - person directory   schedule 01.04.2020