Listbox selected render prop argument does not work
See original GitHub issueHi, in the second Listbox example here the selected
render prop argument does not work. It worked for me only after I changed the Listbox.Option
value
to person.name
instead of person
. Im working on CRA without any other dependencies.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
HeadlessUI render props in Twin - neldeles
Listbox.Option by default renders as a <li> element. But if you pass in the as={Fragment} prop value, it becomes..a fragment. Then in the...
Read more >Listbox (Select)
Each component exposes information about its current state via render props that you can use to conditionally apply different styles or render different...
Read more >Each child in a list should have a unique "key" prop ...
Warning: Each child in a list should have a unique "key" prop. Check the render method of `MyComponent`. in React. The error message...
Read more >@headlessui/react - npm
To style the selected Listbox.Option you can read the selected render prop argument, which tells you whether or not that listbox option is...
Read more >Listbox
If you want access to the listbox's current value and associated label, or its expanded state, you can use a render function. <ListboxInput>...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just had the same problem, the problem is in the example
people
array is inside the component function so it’s created every time with new objects. I was able to fix it by moving the array outside the componenthere’s an example of the working and the broken ones
https://codesandbox.io/s/elastic-swartz-ruy9e?file=/src/App.js
@merodiro yep you are correct, I fixed the readme’s. Thanks!