Skip to content

Invalid property validation for buttonRef when using new React.createRef #11486

Closed
@xaviergonz

Description

@xaviergonz

When I do

class MyC extends React.Component {
  this.someRef = React.createRef<HTMLButtonElement>();
  render() {
    return (
      <IconButton buttonRef={this.someRef} />
    );
  }
}

it works but the following warning is issued

Warning: Failed prop type: Invalid prop `buttonRef` of type `object` supplied to `ButtonBase`, expected `function`.
    in ButtonBase (created by WithStyles(ButtonBase))
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

No warning should be issued

Current Behavior

A warning is issued

Steps to Reproduce (for bugs)

See above

Context

Your Environment

Tech Version
Material-UI latest
React 16.3
browser Chrome 66
etc TS 2.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something doesn't workgood first issueGreat for first contributions. Enable to learn the contribution process.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions