We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example:
// in: import React from "react" import { css } from "styled-components" export default function Example() { return <div css={someCss}>oops</div> } const someCss = css` color: red; ` // out: import _styled from "styled-components"; import React from "react"; import { css } from "styled-components"; var _StyledDiv = _styled.div.withConfig({ displayName: "Example___StyledDiv", componentId: "sc-1j0h0n6-0" })(["", ""], someCss); export default function Example() { return <_StyledDiv>oops</_StyledDiv>; } const someCss = css(["color:red;"]);
At runtime, this code will fail, as it tries to access someCss before it's declared.
someCss
This works if we declare someCss before Example. The someCss style is correctly placed before the styled component.
Example
// in: import React from "react" import { css } from "styled-components" const someCss = css` color: red; ` export default function Example() { return <div css={someCss}>oops</div> } // out: import _styled from "styled-components"; import React from "react"; import { css } from "styled-components"; const someCss = css(["color:red;"]); var _StyledDiv = _styled.div.withConfig({ displayName: "Example___StyledDiv", componentId: "sc-1j0h0n6-0" })(["", ""], someCss); export default function Example() { return <_StyledDiv>oops</_StyledDiv>; }
Repro: https://github.com/kingdaro/styled-components-css-prop-error
Downgraded to 1.10.2 as a workaround for now. It looks like this commit introduced the change in behavior: 9bc3c08
The text was updated successfully, but these errors were encountered:
move injected styled component to end of file
c46710b
in case it references a variable that is declared after the react component that uses it fixes styled-components#260
5bc989b
in case it references a variable that is declared after the react component that uses it fixes #260
Successfully merging a pull request may close this issue.
Example:
At runtime, this code will fail, as it tries to access
someCss
before it's declared.This works if we declare
someCss
beforeExample
. ThesomeCss
style is correctly placed before the styled component.Repro: https://github.com/kingdaro/styled-components-css-prop-error
Downgraded to 1.10.2 as a workaround for now. It looks like this commit introduced the change in behavior: 9bc3c08
The text was updated successfully, but these errors were encountered: