#Undefined error when using Flex component from UI library

114 messages · Page 1 of 1 (latest)

simple valve
#

What from I can tell this repo is meant to provide nextjs + mantine working with SSR?

#
GitHub

A fully featured React components library. Contribute to mantinedev/mantine development by creating an account on GitHub.

GitHub

A fully featured React components library. Contribute to mantinedev/mantine development by creating an account on GitHub.

#

i.e. is there something about theming / emotion that is not compatible with SSR?

simple valve
#

oh has Flex just not yet been added to the v7 alpha?

#

maybe that's the issue

simple valve
#

can anyone confirm this?

rough kite
simple valve
#

(gives an ```
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of Welcome.``` error when i do that)

#

or do I also need to put 'use client' in layout.tsx

rough kite
#

you can compose client component and server component

#

and still have the best of both server and client components

#

without converting the entire page to client components

#

i might need to see code and see where you got it wrong @minor marten

simple valve
#

repo i'm using is from mantine's creator (https://github.com/mantinedev/next-app-template), and I just made a tiny change in components/Welcome/Welcome.tsx, add Flex to the import on line 1, and changing <> to <Flex> on lines 6 and ending line 21

#

oh and with use client at the top of that component, if i don't add use client i get a different error: ```
Error: Unsupported Server Component type: undefined

rough kite
#

its better for us if you don't 'use client' any layout or page lol

simple valve
#

oh ok, i mean yeah i'm happy not use use client if its possible, it's just that in the past when trying to get v13's app directory layout working with Chakra UI, it was the only way

rough kite
#

ure not supposed to

#

wait let me try it myself since it doesn't look hard to reproduce

rough kite
#

it exist on @latest

simple valve
#

Yeah i noticed that yesterday in the documentation, but it's exported in the library isn't it?

rough kite
#

nope

#

maybe tell their devs about it?

#

they have their own discord

simple valve
#

ah ok lol

#

yeah i'll ask there, thanks again for the help alfon

rough kite
#

here is what i meant :/ @simple valve

#

left is using alpha right is npm i @mantine/code@latest

#

maybe they havent ported the entire thing to 7.0.0

simple valve
#

yeah that's probably what it is, the discord FAQ recommends not using app directory until v7 is properly released, should I just use v6 until then and port over once v7 is released?

rough kite
#

what i would do is to dev on v6

#

then port it to v7

#

that is if you like mantine so much <3 haha

simple valve
#

yeah i prefer ui component libraries over just tailwind / plain css, much more productive

rough kite
#

the thing is other emotion-based UI like chakra or MUI is not yet fully supported

#

its nice that mantine is working to have full support

simple valve
#

yeah I've stopped using chakra for that reason as well lol

rough kite
#

and its worth waiting i guess haha

simple valve
#

all good, i'll go the v6 now / v7 later route then

rough kite
#

headless one might say

simple valve
#

ah like headless UI?

rough kite
#

thats one of it

#

like it doesn't depend on root level context like Mantine or Chakra

#

but only use context when required

simple valve
#

i did look at their docs ages back, but they support a very small number of components compared to Chakra/Mantine

rough kite
#

true

#

not trying to distract your mind but

#

headlessui is pretty smol

#

Radix-UI has bigger catalogue

#

and if you truly want to be freed from client component dependency, there is DaisyUI that's based on tailwindcss :)

simple valve
#

oh those are actually pretty comprehensive, especially radix, I'll take a closer look

rough kite
#

if you want pre-built styled using tailwind radix component, check out shadcn

simple valve
#

damn love the design of shadcn

#

there's too many libraries to keep track of in the react ecosystem lol

rough kite
#

so yeah, tailwindcss is not that bad, many good component are based on it haha

rough kite
simple valve
#

i mean what's the main benefit of radix vs mantine/chakra?

rough kite
#

UI libraries are important! I think about them a lot and I hope this video helps you think about them too. Very very very overdue one.

TailwindCSS, MaterialUI, Chakra, Bootstrap, Radix, React-Aria, Master.co, and more 😅

ALL MY CONTENT IS FILMED LIVE ON TWITCH AT https://twitch.tv/theo
ALL MY BEST MEMES ARE ON TWITTER FIRST https://twitter.com/...

▶ Play video
rough kite
#

and radix is headless

simple valve
#

headless just means without styles right?

rough kite
#

does not depend on top-level context

simple valve
#

ah ok

rough kite
#

but yes its also unstyled

simple valve
#

"does not depend on top-level context" as in not using the useContext hook?

rough kite
#

it uses it but not at the top level layout

#

its designed to work independently

#

you can still make a design system for the whole app, but you can also use it separately

#

unless chakra or mantine or MUI, you are forced to use the system

#

things might break if you use Tailwindcss in MUI or Chakra, forexample.

simple valve
#

ah ok

#

so is shadcn like chakra/mantine, but it doesn't use top-level context?

rough kite
#

shadcn is like when you use Tailwdincss and radix, but already sets up all the design system itself

#

so that you can just copy paste shadcn's settings

#

and customize it on your own

#

its more like a template than a library

#

as you know Tailwindcss is preprocessed in the server

simple valve
#

oh ok

rough kite
#

stuff like Chakra/Mantine takes advantage of CSS-in-JS which applies css on runtime

#

which is currently not yet fuilly supported

#

source: next.js docs

simple valve
#

it's still not 100% clear to me which dependency is the bottleneck for getting this working in chakra / mantine, is it emotion that needs to update their codebase to support server components?

rough kite
#

same here :(

simple valve
#

lol i don't think anybody actually knows

rough kite
#

someone who are more familiar with react knows

simple valve
#

shadcn looks very close to what I want, but there's not much point in using that if mantine will support SC soon anyway

rough kite
rough kite
#

people are still going to keep battling out between shadcn and mantine

simple valve
rough kite
#

no, i use my own tailwindcss plus radix

#

its a great way to learn about css and statefull components

simple valve
#

ah ok

#

i'm getting brain overload just looking at all of these different approaches lol

rough kite
#

and the roles of each ui libraries

simple valve
#

with shadcn, im seeing some tailwind given as component props, is that basically overwriting the base tailwind props that shadcn ships with?

rough kite
#

yep

#

actually

#

im not familiar with the details of shadcn and what kind of config they use

#

but i know that shadcn uses tailwind for styling and radix for component states and behaviors

#

for shadcn is one that i might want to clone and learn to make my own component library in the already saturated market mwa ha ha ha

simple valve
#

yet another component library, just what the world needs 🤣

#

alright i'll stick with mantine v6 for my app but i'm going to play around with shadcn, it honestly seems pretty close to what i'm looking for in a ui library

#

i gotta get working lol, thanks again for all the help bro