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] Warning in Chrome because of rootRef prop

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

When I use ListItem with rootRef I get a Warning-Message in console in Chrome:

Warning: React does not recognize the rootRef prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase rootref instead. If you accidentally passed it from a parent component, remove it from the DOM element.

(i need rootRef because i want to show a popover on the listItem, and the listItem should be the anchorElement)

“material-ui”: “1.0.0-beta.23” “react”: “16.2.0”

Chrome: Version 62.0.3202.94

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Aug 26, 2018

@perevezencev You might want to use the RootRef component:

import React, { Component } from "react";
import ReactDOM from "react-dom";

import List from "@material-ui/core/List";
import RootRef from "@material-ui/core/RootRef";
import ListItem from "@material-ui/core/ListItem";

class App extends Component {
  componentDidMount = () => {
    console.log(this.listItemRef);
  };

  listItemRef = React.createRef();

  render = () => (
    <div className="App">
      <List>
        <RootRef rootRef={this.listItemRef}>
          <ListItem>item-1</ListItem>
        </RootRef>
        <ListItem>item-2</ListItem>
      </List>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

https://codesandbox.io/s/wqvx1qr2v8

0reactions
perevezencevcommented, Aug 26, 2018

@oliviertassinari thank you, its work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ListItem] Warning in Chrome because of rootRef prop #9494
When I use ListItem with rootRef I get a Warning-Message in console in Chrome: Warning: React does not recognize the rootRef prop on...
Read more >
Breaking changes in v5, part two: core components - Material UI
The clone prop was removed because its behavior can be obtained by applying the sx prop directly to the child if it is...
Read more >
material-ui/core/CHANGELOG.md - UNPKG
The Tabs `fullWidth` and `scrollable` properties can't be used at the same time. The API change prevents any awkward usage. 22.
Read more >
DataSnapshot | JavaScript SDK | Node.js (client) API reference
var rootRef = firebase.database().ref(); rootRef.once("value") ... Because of the way JavaScript objects work, the ordering of data in the JavaScript object ...
Read more >
Diff - 0df2607f98..0e821c2fa2 - chromium/src - Git at Google
-58,6 +59,10 @@ // Scroll the notification list to ... Log a warning message because, for now, this should not basically happen -...
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