Skip to content

Commit 46695fd

Browse files
bagedevimocbala-stripe
authored andcommitted
Convert React imports to use the recommended import syntax
Doing so prevents any named imports leaking into the output type definitions (.d.ts files) and follows with what seems to be the React official recommendations [1]. The more 'correct' fix would be only import those components that are needed by each component, but that's a bigger change. [1] facebook/react#18102 Fixes #569
1 parent 99ac8ad commit 46695fd

9 files changed

+12
-9
lines changed

src/components/Elements.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {StrictMode} from 'react';
1+
import * as React from 'react';
2+
import {StrictMode} from 'react';
23
import {render, act} from '@testing-library/react';
34
import {renderHook} from '@testing-library/react-hooks';
45

src/components/Elements.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'react';
88
import * as stripeJs from '@stripe/stripe-js';
99

10-
import React from 'react';
10+
import * as React from 'react';
1111
import PropTypes from 'prop-types';
1212

1313
import {usePrevious} from '../utils/usePrevious';

src/components/EmbeddedCheckout.client.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import {render, act} from '@testing-library/react';
33

44
import * as EmbeddedCheckoutProviderModule from './EmbeddedCheckoutProvider';

src/components/EmbeddedCheckout.server.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment node
33
*/
44

5-
import React from 'react';
5+
import * as React from 'react';
66
import {renderToString} from 'react-dom/server';
77

88
import * as EmbeddedCheckoutProviderModule from './EmbeddedCheckoutProvider';

src/components/EmbeddedCheckout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {FunctionComponent} from 'react';
1+
import * as React from 'react';
2+
import {FunctionComponent} from 'react';
23
import {useEmbeddedCheckoutContext} from './EmbeddedCheckoutProvider';
34
import {isServer} from '../utils/isServer';
45

src/components/EmbeddedCheckoutProvider.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import {render, act} from '@testing-library/react';
33
import {renderHook} from '@testing-library/react-hooks';
44

src/components/EmbeddedCheckoutProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, PropsWithChildren, ReactNode} from 'react';
2-
import React from 'react';
2+
import * as React from 'react';
33

44
import {usePrevious} from '../utils/usePrevious';
55
import {UnknownOptions} from '../utils/extractAllowedOptionsUpdates';

src/components/createElementComponent.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {StrictMode} from 'react';
1+
import * as React from 'react';
2+
import {StrictMode} from 'react';
23
import {render, act, waitFor} from '@testing-library/react';
34

45
import * as ElementsModule from './Elements';

src/components/createElementComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {FunctionComponent} from 'react';
33
import * as stripeJs from '@stripe/stripe-js';
44

5-
import React from 'react';
5+
import * as React from 'react';
66

77
import PropTypes from 'prop-types';
88

0 commit comments

Comments
 (0)