I'm having a trouble of rendering pseudo before content dynamically in styled-components.
Am I doing something wrong?
I have no problem when I render pseudo before content statically, but it doesn't work when I try it dynamically.
React Component
const Test = (props) => {
return (
<Text before={12345}>
{props.children}
</Text>
);
};
Styled Component(Not Work)
const Text = styled.span`
&:before {
content: ${props => {
console.log(props.before); // I see '12345' in log.
return props.before;
}
}
`;
Styled Component(This works fine)
const Text = styled.span`
&:before {
content: '12345'
}
`;