Noob help with Keys/useListData in a Select Component #6620
Replies: 4 comments 2 replies
-
Your codesandbox is private, you'll need to mark it as public. I think you're getting mixed up between item vs the selection key "id". It may help to log out |
Beta Was this translation helpful? Give feedback.
-
*edit: I think I fixed it 😊 Hi @snowystinger, thanks for the reply, So I decided to ditch using my own state and try to implement Have spent a long time on this so I think I'm close, and I hope it's made for a better question. I'm just struggling to type the
My app structure is like this: App.tsx
JobTypeSelect.tsx
ItemSelect.tsx
|
Beta Was this translation helpful? Give feedback.
-
Sorry for bumping again! Have just noticed that the Just not sure why neither seem to be working? Demo link
|
Beta Was this translation helpful? Give feedback.
-
Because the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
Sorry if this isn't the place for this sort of beginner question, but I'm really struggling to make a reusable Select Component with Keys and/or useListData.
So far I can make it sort of work with strings and
useState
, but it means I've only got access to the selected index:Live Demo here
Code Snippets:
// JobTypeSelect.tsx
Obviously this isn't the right way to do it, but every time I try and replace my state with
useListData
I struggle typing theonSelectionChange
and other properties I try and pass, even with the api hereReally would appreciate any guidance, or even links to example Components that are both typed and more reusable (most examples I've found tend to use hooks)
Thanks a lot!
Nick
Beta Was this translation helpful? Give feedback.
All reactions