Before and After pseudo classes used with styled-components

Pseudo-selectors in styled-components work just like they do in CSS. (or rather, Sass) Whatever isn’t working is likely a problem in your specific code, but that’s hard to debug without seeing the actual code!

Here is an example of how to use a simple :after:

const UnicornAfter = styled.div`
  &:after {
    content: " 🦄";
  }
`;

<UnicornAfter>I am a</UnicornAfter> // renders: "I am a 🦄"

If you post your code I’ll likely be able to help debug your specific issue!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)