Styled-components: Passing props doesn't work with :after and :before

Created on 20 Feb 2018  路  1Comment  路  Source: styled-components/styled-components

Version

styled-components: 3.1.6

Reproduction

https://codesandbox.io/s/jp17xk248w

Expected Behavior

Passing props works well with :after, :before

Actual Behavior

Passing props doesn't work with :after, :before

Most helpful comment

If you look in the DevTools you'll see that you're outputting invalid CSS:

screen shot 2018-02-20 at 14 39 51

You're missing a set of quotes around the test.

-    content: ${() => "test"};
+    content: ${() => '"test"'};

That single change makes it work: https://codesandbox.io/s/23mrnp9p30


Next time you have a usage question please either ask it on StackOverflow or in the community. Thanks.

>All comments

If you look in the DevTools you'll see that you're outputting invalid CSS:

screen shot 2018-02-20 at 14 39 51

You're missing a set of quotes around the test.

-    content: ${() => "test"};
+    content: ${() => '"test"'};

That single change makes it work: https://codesandbox.io/s/23mrnp9p30


Next time you have a usage question please either ask it on StackOverflow or in the community. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smooJitter picture smooJitter  路  3Comments

ivan-navarro-75 picture ivan-navarro-75  路  3Comments

probablyup picture probablyup  路  3Comments

drcmda picture drcmda  路  3Comments

redroot picture redroot  路  3Comments