The issue involves reserved variable handling in React Compiler.
The issue arises because the React Compiler treats '$' as a reserved variable in Client Components, conflicting with a user-defined component. Either the compiler needs to handle this case by renaming the variable or documentation should clarify this limitation. The scope involves understanding compiler internals and reserved variable handling.
In my codebase, I have a utility component called <$> that I use as a succinct shortcut for inline styles.
// this
<$ fs="10em" x="30%" y="10%">
<h1>Hello World!</h1>
</$>
// is equivalent to this
<h1 style={{fontSize: "10em", left: "30%", position: "absolute", top: "10%"}}>Hello World!</h1>
This works in Server Components, but breaks in Client Components. It seems that React Compiler uses $ and _c as reserved variables, which overwrite my component. So either
$ in the scope and choose a different variable name, orEvery time
19.2.4
1.0.0
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!