Don't directly import from React, use @wordpress/element. (https://github.com/woocommerce/woocommerce-admin/pull/4978)

This commit is contained in:
Jeff Stieler 2020-08-13 08:29:29 -04:00 committed by GitHub
parent 2ca0182582
commit 5fbc511f25
3 changed files with 4 additions and 6 deletions

View File

@ -4,8 +4,7 @@
import { __ } from '@wordpress/i18n';
import { decodeEntities } from '@wordpress/html-entities';
import { escapeRegExp } from 'lodash';
import { Fragment } from '@wordpress/element';
import { useEffect, useMemo, useState } from 'react';
import { Fragment, useEffect, useMemo, useState } from '@wordpress/element';
import { getSetting } from '@woocommerce/wc-admin-settings';
import { SelectControl, TextControl } from '@woocommerce/components';

View File

@ -1,8 +1,7 @@
/**
* External dependencies
*/
import { Component } from '@wordpress/element';
import React from 'react';
import { Component, createElement } from '@wordpress/element';
class Example extends Component {
state = {
@ -28,7 +27,7 @@ class Example extends Component {
}
this.setState( {
example: React.createElement(
example: createElement(
exampleComponent.default || exampleComponent
),
} );

View File

@ -4,7 +4,7 @@
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { Button } from '@wordpress/components';
import { useState } from 'react';
import { useState } from '@wordpress/element';
import PropTypes from 'prop-types';
import { withDispatch, withSelect } from '@wordpress/data';