question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ListItem] - Unable to provide props to li node

See original GitHub issue

If I understand your ListItem.js correctly, one small change would make it a lot easier to build

export default class DraggableListItem extends ListItem {}

In the ListItem.js you have

    return (
      <li
        style={style}
        className={cn('md-list-item', {
          'md-list-item--nested-container': nestedItems,
        }, className)}
        ref={this._setContainer}
      >
        <AccessibleFakeInkedButton
          {...props}
          __SUPER_SECRET_REF__={this._setTile}

and by using the {...props} for the <AccessibleFakeInkedButton /> you cannot further specialize the component.

I propose to let the ListItem be all about standard <li> and have the {...props} added to the <li>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mlaursencommented, Mar 2, 2017

This might work. I might need to update the documentation a bit and hopefully give some better migration warnings. The current ListItem looks like this.

It might be that a new prop itemProps is added instead. One of the main reasons for passing all the remaining props to the AccessibleFakeInkedButton is so that the following is possible:

import { Link } from 'react-router';

...

<ListItem primaryText="Some Route" component={Link} to="some-route" />

Another possibility is to just extract any of the event listeners and apply them to the ItemComponent instead of the AccessibleFakeButton. I think it’ll just take some testing.

0reactions
mlaursencommented, Jul 14, 2017

I’m going to close this one in favor of #439

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ListItem] <ListItem component /> require to forwardRef #23622
Warning: Failed prop type: Invalid prop `component` supplied to `ForwardRef(ButtonBase)`. Expected an element type that can hold a ref.
Read more >
How to display an unordered list (UL) with list items (LI) within ...
The first problem I notice is with index.js: import React from 'react'; import ReactDOM from 'react-dom'; import DataList from '.
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 >
ListItem API - Material UI - MUI
Name Type Default alignItems 'center' | 'flex‑start' 'center' autoFocus bool false button bool false
Read more >
React anti-pattern: don't make <li> your component's root
const ArticleList = (props) => { return <div class="articles"> <ul class="article-list"> { props.articles.map(article => <li ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found