Skip to content

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

@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

    good first issueGreat for first contributions. Enable to learn the contribution process.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions