styled-components / styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
https://styled-components.com
MIT License
40.51k stars 2.5k forks source link

Cannot access '<component_name>' before initialization #3716

Open FezVrasta opened 2 years ago

FezVrasta commented 2 years ago

Environment

Create React App CodeSandbox template.

Reproduction

https://codesandbox.io/s/great-golick-s3ofx0?file=/src/App.js

Steps to reproduce

Define a styled component and then attempt to render it while assigning a css property to it.

Expected Behavior

The app should render properly.

Actual Behavior

Cannot access '<component_name>' before initialization

The problem seem to reproduce only starting from styled-components@5.3.4 on Code Sandbox, but on my local environment I can track it back to 5.3.0

bruce-c-liu commented 2 years ago

I am also experiencing this issue.

a1994lex commented 1 year ago

Trying to update styled-components to >5.3.0 and running into the same issue! Has anyone found a work around? Really don't want to give up the "styled-components/macro" as it allows me to use the inline css property.

import styled from 'styled-components/macro'

<Test css=`` />
jy617lee commented 1 year ago

same problem as well

vfvtll commented 4 months ago

Same problem