Next.js Discord

Discord Forum

shadcn <DropdownMenu> TS Error 'DropdownMenu' Refers to a Value, but Used as a Type

Answered
Chartreux posted this in #help-forum
Open in Discord
Avatar
ChartreuxOP
I'm exploring shadcn's data table and I reach this point https://ui.shadcn.com/docs/components/data-table#row-actions . I added the dropdown and pasted the code correctly, but I got errors such as
The left-hand side of an assignment expression must be a variable or a property access.ts(2364)
'DropdownMenu' refers to a value, but is being used as a type here. Did you mean 'typeof DropdownMenu'


From the images, I guess the problem is the imported dropdown components aren't being recognized (from the muted import text).
What's the real issue here? And how to solve it?
Image
Image
Image
Answered by joulev
name your file .tsx instead of .ts
View full answer

3 Replies