Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Remove deprecated innerRef prop #26028

Merged
merged 1 commit into from
Apr 29, 2021
Merged

Conversation

m4theushw
Copy link
Member

@m4theushw m4theushw commented Apr 28, 2021

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
Copy link

mui-pr-bot commented Apr 28, 2021

Details of bundle changes

Generated by 🚫 dangerJS against b22a562

Copy link
Member

@mnajdova mnajdova left a comment

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 <54475686+anshuman9999@users.noreply.github.com>
Co-authored-by: simonecervini <69400730+simonecervini@users.noreply.github.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants