themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.77k stars 395 forks source link

Tabs SSR not working #1395

Closed vitalijalbu closed 1 month ago

vitalijalbu commented 1 month ago

Steps to reproduce

just create a nextjs +14 pro version and you'll see that it's not compatible yet...

Current behavior

Describe what is currently happening and why it's a problem.

Expected behavior

must work perfectly

Context

Screenshot 2024-05-16 alle 19 22 52

Screenshot 2024-05-16 alle 19 23 04
SutuSebastian commented 1 month ago

Compound components are not supported in RSC.

Please read: https://flowbite-react.com/docs/getting-started/server-components#compound-components

To solve ur issue, just add "use client" directive at the top of ur file.

vitalijalbu commented 1 month ago

Compound components are not supported in RSC.

Please read: https://flowbite-react.com/docs/getting-started/server-components#compound-components

To solve ur issue, just add "use client" directive at the top of ur file.

hi yes i solved by using "use client", and move it in another component. basically my page structure is: page.tsx to get data (ssr)

then i should split it into client mini-components to render flowbite?? is that a good approach? thanks.

SutuSebastian commented 1 month ago

U did the split correctly.

Btw, u should only use the client directive when components are ONLY client by nature (eg: they require stateful props), otherwise instead of Tabs.Item u can do TabItem and import each sub-component separarely.