Material-ui: Tooltip: TypeError: Cannot read property 'className' of undefined

Created on 31 Oct 2019  路  7Comments  路  Source: mui-org/material-ui

I am getting this error. Code is crashing.
Screenshot 2019-10-31 at 17 50 39
Here are my imports:
Screenshot 2019-10-31 at 17 51 45
And this is how I am calling it in m code (simple example from docs):
Screenshot 2019-10-31 at 17 51 54

Tooltip

Most helpful comment

Check the documentation, the Tooltip requires an element as a child that forward the ref, for instance:

<Tooltip title="Foo">
  <span>Bar</span>
</Tooltip>

All 7 comments

Check the documentation, the Tooltip requires an element as a child that forward the ref, for instance:

<Tooltip title="Foo">
  <span>Bar</span>
</Tooltip>

Maybe that could be the error message if there is no child element present.

@elitan #17480

Agreed, I had this exact error, had to wrap my text inside a <Button>

I bumped into this when I had 2 components inside the tooltip. I'm guessing Tooltip does not know how do deal with that. I removed one component and the problem went away.

@cyrfer The tooltip requires a React element that forward refs, a node isn't supported.

@thebazshah in the tooltip u have to required atleast one tag or react element but dont use more than one if u use then again this show same error
like:

<Tooltip title="Delete">
     <button onClick={additem}><AddShoppingCartIcon /></button>
    <br />
     </Tooltip>

this is show error

if u remove
then this error not shown

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericraffin picture ericraffin  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

sys13 picture sys13  路  3Comments

ghost picture ghost  路  3Comments

reflog picture reflog  路  3Comments