`List` skips child components that are indirectly composed of `List.Item`
See original GitHub issueWhat package has an issue
Describe the bug
function MyList() {
return (
<List>
{
['a', 'b', 'c'].map((value, i) => (
<MyListItem item={value} key={i} />
)
}
</List>
)
}
function MyListItem({ item }) {
return (
<List.Item>{item}</List.Item>
)
}
The above code doesn’t render anything inside the List
. However, it is expected to render List.Item
s
This is caused by filterChildByType
function here: https://github.com/mantinedev/mantine/blob/a140cbca9dbf0f90b2314b25a64cc58413dacbc5/src/mantine-core/src/components/List/List.tsx#L68
In which browser did the problem occur
Firefox
If possible, please include a link to a codesandbox with the reproduced problem
No response
Do you know how to fix the issue
Yes
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Possible fix
A possible fix is to introduce a new prop named indirectItems
or noFilterChildren
that skips filtering children.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
python - Get all child elements - Stack Overflow
It is an expensive operation to get all direct/indirect children. ... Yes, you can use find_elements_by_ to retrieve children elements into a list....
Read more >Descendant combinator - CSS: Cascading Style Sheets | MDN
Selectors that utilize a descendant combinator are called descendant selectors. /* List items that are descendants of the "my-things" list */ ul ...
Read more >Warning: Each Child in a List Should Have a Unique 'key' Prop
When creating a list in the UI from an array with JSX, you should add a key prop to each child and to...
Read more >3 levels of CSS-selectors to select all elements - Portiva.nl
This is how you can skip levels of explicit selectors to get to your target selector, through 'unique' landmarks within your template. Child...
Read more >What is React Memo? How to use React.memo()
As for this new child component, it will simply be returning the <li> item with list title to display after mapping:
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 FreeTop 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
Top GitHub Comments
Fixed in 4.0.2
Timeline.Item depends on its index, there is no way of getting this index during ssr, so it will remain as is (it will not be migrated to context as List.Item).