You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I used your documentation to set up stailwc but getting an error, when using tw. styling which says the following:
- error ./app/page.tsx
ReactServerComponentsError:
The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.
,-[/home/XXX/Development/XXX/app/page.tsx:1:1]
1 | 'use client';
: ^^^^^^^^^^^^^
2 |
3 | import styled from 'styled-components';
`----
Import path:
./app/page.tsx
Right now I'm using an example from the styled-components set up of Next.js, which looks like this:
Hi! Neither emotion nor styled-components support serverside rendered components yet. There is more detail in this discussion #12
In the mean time, if you wish to use emotion or styled-components with nextjs and the app router, please include the 'use client' directive as described in the error :)
I am going to leave this open for now as a tracking issue.
Hej. I've set up everything exactly the way described in your documentation and how Next.js told me to set up
styled-components
.I use the App Router for Next.js as I find this one pretty useful in my use-case. I've used this documentation part to set up
styled-components
: https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-componentsThen I used your documentation to set up
stailwc
but getting an error, when usingtw.
styling which says the following:Right now I'm using an example from the
styled-components
set up of Next.js, which looks like this:What am I doing wrong?
The text was updated successfully, but these errors were encountered: