Next.js Discord

Discord Forum

Type error: 'x' cannot be used as a JSX component.

Answered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Hi! I'm getting this error when building my project. It seems to happen on some computers, not all. And we have no idea what may be causing it.
Thanks in advance!
Answered by Giant panda
Solution: Apparently it was the styled-components version that was causing this error, here's the fix
View full answer

4 Replies

New Guinea Singing Dog
Is it a server component you are trying to render inside a client one? And are you sure you are returning some JSX and not breaking early or doing some other flow control?
Could you send the code for it?
@New Guinea Singing Dog Is it a server component you are trying to render inside a client one? And are you sure you are returning some JSX and not breaking early or doing some other flow control?
Giant pandaOP
It’s a simple component, we hardly use ssr so it’s not that.
If we comment this component it happens in another.

This component wasn’t changed recently which makes me think is a configuration/dependency issue
Out latest big install was related to i18n translations so might be that
I’m not in office right now so can’t send code, but will in the morning if we can’t find a solution
Giant pandaOP
Solution: Apparently it was the styled-components version that was causing this error, here's the fix
Answer