Skip to content

[core] Remove deprecated innerRef prop#26028

Merged
mnajdova merged 1 commit into
mui:nextfrom
m4theushw:remove-innerRef
Apr 29, 2021
Merged

[core] Remove deprecated innerRef prop#26028
mnajdova merged 1 commit into
mui:nextfrom
m4theushw:remove-innerRef

Conversation

@m4theushw

@m4theushw m4theushw commented Apr 28, 2021

Copy link
Copy Markdown
Collaborator

BREAKING CHANGES

  • withStyles

Replace the innerRef prop with the ref prop. Refs are now automatically forwarded to the inner component.

import * as React from 'react';
import { withStyles } from '@material-ui/core/styles';
const MyComponent = withStyles({
  root: {
    backgroundColor: 'red',
  },
})(({ classes }) => <div className={classes.root} />);
function MyOtherComponent(props) {
  const ref = React.useRef();
- return <MyComponent innerRef={ref} />;
+ return <MyComponent ref={ref} />;
}
  • withTheme

Replace the innerRef prop with the ref prop. Refs are now automatically forwarded to the inner component.

import * as React from 'react';
import { withTheme  } from '@material-ui/core/styles';
const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>);
function MyOtherComponent(props) {
  const ref = React.useRef();
- return <MyComponent innerRef={ref} />;
+ return <MyComponent ref={ref} />;
}

Part of #20012

@m4theushw m4theushw changed the title [core] Remove innerRef [core] Remove deprecated innerRef prop Apr 28, 2021
@mui-pr-bot

mui-pr-bot commented Apr 28, 2021

Copy link
Copy Markdown

Details of bundle changes

Generated by 🚫 dangerJS against b22a562

@oliviertassinari oliviertassinari added the breaking change Introduces changes that are not backward compatible. label Apr 28, 2021

@mnajdova mnajdova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mnajdova
mnajdova merged commit 8b17837 into mui:next Apr 29, 2021
eps1lon pushed a commit to siriwatknp/material-ui that referenced this pull request Apr 29, 2021
[core] Remove deprecated innerRef prop (mui#26028)
@m4theushw
m4theushw deleted the remove-innerRef branch April 29, 2021 11:36
siriwatknp added a commit that referenced this pull request May 12, 2021
* migrate to emotion

* make styleProps optional

* remove lint and add fn name

* use yearButton from styles

* revert types

* [docs] Document all the colors available (#26015)

* [Timeline] Add support for position override on items (#25974)

* [core] Remove deprecated innerRef prop (#26028)

[core] Remove deprecated innerRef prop (#26028)

* [theme] Rename `createMuiTheme` to `createTheme` (#25992)

* [pickers] Remove redundant aria-hidden (#26014)

* [internal][pickers] Remove unused styles (#26023)

* [pickers] Toggle mobile keyboard view in the same commit as the view changes (#26017)

* [DateRangePicker] Fix not being opened on click (#26016)

* Inline classes

* type -> interface

* sort asc

* default props are private

* remove uneccesary type casting

* follow convention

* trigger pipeline

Co-authored-by: Anshuman Pandey <[email protected]>
Co-authored-by: simonecervini <[email protected]>
Co-authored-by: Matheus Wichman <[email protected]>
Co-authored-by: Sebastian Silbermann <[email protected]>
Co-authored-by: Olivier Tassinari <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants