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

feat: remove remaining React imports #9907

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/adding-a-css-modules-stylesheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CSS Modules let you use the same CSS class name in different files without worry
## `Button.js`

```js
import React, { Component } from 'react';
import { Component } from 'react';
import styles from './Button.module.css'; // Import css modules stylesheet as styles
import './another-stylesheet.css'; // Import regular stylesheet

Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/adding-a-stylesheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This project setup uses [webpack](https://webpack.js.org/) for handling all asse
## `Button.js`

```js
import React, { Component } from 'react';
import { Component } from 'react';
import './Button.css'; // Tell webpack that Button.js uses these styles

class Button extends Component {
Expand Down
1 change: 0 additions & 1 deletion docusaurus/docs/adding-images-fonts-and-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ To reduce the number of requests to the server, importing images that are less t
Here is an example:

```js
import React from 'react';
import logo from './logo.png'; // Tell webpack this JS file uses this image

console.log(logo); // /logo.84287d09.png
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/code-splitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export { moduleA };
## `App.js`

```js
import React, { Component } from 'react';
import { Component } from 'react';

class App extends Component {
handleClick = () => {
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/importing-a-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For example:
## `Button.js`

```js
import React, { Component } from 'react';
import { Component } from 'react';

class Button extends Component {
render() {
Expand All @@ -26,7 +26,7 @@ export default Button; // Don’t forget to use export default!
## `DangerButton.js`

```js
import React, { Component } from 'react';
import { Component } from 'react';
import Button from './Button'; // Import a component from another file

class DangerButton extends Component {
Expand Down
2 changes: 0 additions & 2 deletions docusaurus/docs/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ There is a broad spectrum of component testing techniques. They range from a “
Different projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating basic smoke tests for your components:

```js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

Expand Down Expand Up @@ -112,7 +111,6 @@ import '@testing-library/jest-dom';
Here's an example of using `react-testing-library` and `jest-dom` for testing that the `<App />` component renders "Learn React".

```js
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

Expand Down
1 change: 0 additions & 1 deletion docusaurus/website/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
Expand Down
1 change: 0 additions & 1 deletion packages/cra-template-typescript/template/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

Expand Down
1 change: 0 additions & 1 deletion packages/cra-template-typescript/template/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';

Expand Down
6 changes: 3 additions & 3 deletions packages/cra-template-typescript/template/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
Expand All @@ -8,9 +8,9 @@ const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<StrictMode>
<App />
</React.StrictMode>
</StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
6 changes: 3 additions & 3 deletions packages/cra-template/template/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<StrictMode>
<App />
</React.StrictMode>
</StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/components/CloseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import type { Theme } from '../styles';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/components/CodeBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';

const _preStyle = {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/components/Collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useState, useContext } from 'react';
import { useState, useContext } from 'react';
import { ThemeContext } from '../iframeScript';

import type { Element as ReactElement } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext, useEffect } from 'react';
import { useContext, useEffect } from 'react';
import { ThemeContext } from '../iframeScript';

import type { Node as ReactNode } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import type { Theme } from '../styles';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import type { Theme } from '../styles';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import type { Theme } from '../styles';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import ErrorOverlay from '../components/ErrorOverlay';
import Footer from '../components/Footer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

/* @flow */
import React from 'react';
import Header from '../components/Header';
import StackTrace from './StackTrace';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import ErrorOverlay from '../components/ErrorOverlay';
import CloseButton from '../components/CloseButton';
import NavigationBar from '../components/NavigationBar';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/containers/StackFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useState, useContext } from 'react';
import { useState, useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import CodeBlock from './StackFrameCodeBlock';
import { getPrettyURL } from '../utils/getPrettyURL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { useContext } from 'react';
import { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
import CodeBlock from '../components/CodeBlock';
import { absolutifyCaret } from '../utils/dom/absolutifyCaret';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/containers/StackTrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* @flow */
import React, { Component } from 'react';
import { Component } from 'react';
import StackFrame from './StackFrame';
import Collapsible from '../components/Collapsible';
import { isInternalFile } from '../utils/isInternalFile';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/iframeScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import 'react-app-polyfill/ie9';
import React, { createContext } from 'react';
import { createContext } from 'react';
import ReactDOM from 'react-dom';
import CompileErrorContainer from './containers/CompileErrorContainer';
import RuntimeErrorContainer from './containers/RuntimeErrorContainer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { Component, createElement } from 'react';
import { Component, createElement } from 'react';
import PropTypes from 'prop-types';

class BuiltEmitter extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
import load from 'absoluteLoad';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import NodePath from './BaseUrl';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

const ExpandEnvVariables = () => (
<span>
<span id="feature-expand-env-1">{process.env.REACT_APP_BASIC}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import ExpandEnvVariables from './ExpandEnvVariables';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

const FileEnvVariables = () => (
<span>
<span id="feature-file-env-original-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import FileEnvVariables from './FileEnvVariables';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

const PublicUrl = () => (
<span id="feature-public-url">{process.env.PUBLIC_URL}.</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import PublicUrl from './PublicUrl';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

const ShellEnvVariables = () => (
<span id="feature-shell-env-variables">
{process.env.REACT_APP_SHELL_ENV_MESSAGE}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import ShellEnvVariables from './ShellEnvVariables';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';

function load() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import ArrayDestructuring from './ArrayDestructuring';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';

function load(users) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import ArraySpread from './ArraySpread';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';

async function load() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import AsyncAwait from './AsyncAwait';

Expand Down
Loading