From fa9bfb0183e464c0592355f6734864332988c0d5 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 28 Jul 2020 10:28:56 +0200 Subject: [PATCH 1/3] [RootRef] Remove component --- .eslintrc.js | 1 - docs/pages/api-docs/root-ref.js | 15 ---- docs/pages/api-docs/root-ref.md | 63 -------------- .../pages/guides/migration-v4/migration-v4.md | 12 +++ packages/material-ui/src/RootRef/RootRef.d.ts | 52 ----------- packages/material-ui/src/RootRef/RootRef.js | 87 ------------------- .../material-ui/src/RootRef/RootRef.test.js | 77 ---------------- packages/material-ui/src/RootRef/index.d.ts | 2 - packages/material-ui/src/RootRef/index.js | 1 - packages/material-ui/src/index.d.ts | 3 - packages/material-ui/src/index.js | 3 - 11 files changed, 12 insertions(+), 304 deletions(-) delete mode 100644 docs/pages/api-docs/root-ref.js delete mode 100644 docs/pages/api-docs/root-ref.md delete mode 100644 packages/material-ui/src/RootRef/RootRef.d.ts delete mode 100644 packages/material-ui/src/RootRef/RootRef.js delete mode 100644 packages/material-ui/src/RootRef/RootRef.test.js delete mode 100644 packages/material-ui/src/RootRef/index.d.ts delete mode 100644 packages/material-ui/src/RootRef/index.js diff --git a/.eslintrc.js b/.eslintrc.js index 320cbbcd6a492a..db0568c7ca7de2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -72,7 +72,6 @@ module.exports = { 'react/no-array-index-key': 'off', // This rule is great for raising people awareness of what a key is and how it works. 'react/no-danger': 'error', 'react/no-direct-mutation-state': 'error', - 'react/no-find-dom-node': 'off', // Required for backward compatibility. TODO v5, drop 'react/require-default-props': 'off', // Not always relevant 'react/sort-prop-types': 'error', // This depends entirely on what you're doing. There's no universal pattern diff --git a/docs/pages/api-docs/root-ref.js b/docs/pages/api-docs/root-ref.js deleted file mode 100644 index 191416ac953e93..00000000000000 --- a/docs/pages/api-docs/root-ref.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; -import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown'; - -const pageFilename = 'api/root-ref'; -const requireRaw = require.context('!raw-loader!./', false, /\/root-ref\.md$/); - -export default function Page({ docs }) { - return ; -} - -Page.getInitialProps = () => { - const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw }); - return { demos, docs }; -}; diff --git a/docs/pages/api-docs/root-ref.md b/docs/pages/api-docs/root-ref.md deleted file mode 100644 index bbb3aea0e03bc4..00000000000000 --- a/docs/pages/api-docs/root-ref.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -filename: /packages/material-ui/src/RootRef/RootRef.js ---- - - - -# RootRef API - -

The API documentation of the RootRef React component. Learn more about the props and the CSS customization points.

- -## Import - -```js -import RootRef from '@material-ui/core/RootRef'; -// or -import { RootRef } from '@material-ui/core'; -``` - -You can learn more about the difference by [reading this guide](/guides/minimizing-bundle-size/). - -⚠️⚠️⚠️ -If you want the DOM element of a Material-UI component check out -[FAQ: How can I access the DOM element?](/getting-started/faq/#how-can-i-access-the-dom-element) -first. - -This component uses `findDOMNode` which is deprecated in React.StrictMode. - -Helper component to allow attaching a ref to a -wrapped element to access the underlying DOM element. - -It's highly inspired by https://github.com/facebook/react/issues/11401#issuecomment-340543801. -For example: -```jsx -import React from 'react'; -import RootRef from '@material-ui/core/RootRef'; - -function MyComponent() { - const domRef = React.useRef(); - - React.useEffect(() => { - console.log(domRef.current); // DOM node - }, []); - - return ( - - - - ); -} -``` - - - -## Props - -| Name | Type | Default | Description | -|:-----|:-----|:--------|:------------| -| children* | element | | The wrapped element. | -| rootRef* | refType.isRequired | | A ref that points to the first DOM node of the wrapped element. | - -The component cannot hold a ref. - - diff --git a/docs/src/pages/guides/migration-v4/migration-v4.md b/docs/src/pages/guides/migration-v4/migration-v4.md index da9a714324b48d..50a26c0f099a6c 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4.md +++ b/docs/src/pages/guides/migration-v4/migration-v4.md @@ -110,6 +110,18 @@ This change affects almost all components where you're using the `component` pro /> ``` +### RootRef + +- This component was removed. + You can get a reference to the underlying DOM node of our components via `ref` prop. + + ```diff + - + -