Next.js Discord

Discord Forum

why this error when using Nativebase components without 'use client'

Unanswered
Jack Riddles posted this in #help-forum
Open in Discord
Is there a way to resolve this issue which forces me to use the 'use client' in files with components using nativebase tags .
https://github.com/bijomathewjose/NextJs-App-Router-with-NativeBase

3 Replies

Sun bear
You are using the component like this:

<Text>some</Text>


And this is the component:
export const Text = {
    baseStyle: ({ colorMode }) => {
        return {
            color: colorMode === 'dark' ? 'red.800' : 'blue.900',
            fontWeight: 800,
            fontFamily: 'Kalnia Glaze',
        };
    },
}


The component is not really a component you can use like it. I would expect the component to receive the children and return it like

export default function Text({children}:{children: ReactNode}) {
 return (
<div>{children}</div>
)
}