Next.js Discord

Discord Forum

i am facing some issue how can i solve

Answered
Griffon Bleu de Gascogne posted this in #help-forum
Open in Discord
Avatar
Griffon Bleu de GascogneOP
i am declaring like this
import { Key } from "react";
const [selectedId, setSelectedId] = useState<Key>("");
Image
Answered by rex1410
I was able to temporary fix by replacing import { Key } from 'react' with import { Key } from '@react-types/shared' as described.
View full answer

14 Replies

Avatar
@Griffon Bleu de Gascogne is your selectedKey prop of typeKey from React?
Avatar
Griffon Bleu de GascogneOP
It's a type Key
Avatar
its your custom type?
Avatar
Griffon Bleu de GascogneOP
It's a useState
Image
Avatar
I am not talking about the state variable selectedId, I want to know what is the type of the prop selectedKey
Avatar
Griffon Bleu de GascogneOP
I am using NextUi from there I took component.
Image
Avatar
@Griffon Bleu de Gascogne found the problem
this is a known bug in next ui
Avatar
I was able to temporary fix by replacing import { Key } from 'react' with import { Key } from '@react-types/shared' as described.
Answer
Avatar
use this ^
Avatar
Griffon Bleu de GascogneOP
Ok
Thank you means a lot 😊
Avatar
no worries!