With styled components, I can pass in values and then get conditional css based on those values. For instance, I can do,
const ContainerStyled = styled.div<{isOpen: boolean}>`
${({ isOpen }) => isOpen
? background-color: red
: ''
}
`
However, I'm wondering if it's possible to conditionally render a different component, based on that value? For instance, something like,
const ContainerStyled = styled(isOpen ? ArrowUpIcon : ArrowDownIcon)`
${({ isOpen }) => isOpen
? background-color: red
: ''
}
`
isOpen
? On writingstyled(isOpen ? ArrowUpIcon : ArrowDownIcon)
doesisOpen
already evaluated? Your example not clear. Please try showing expected usecase of rendering – Dennis Vash