diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js b/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js index c60a93a957..6f35196b1a 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js @@ -1,16 +1,14 @@ import React, { useState } from 'react'; -import { withRouter } from 'react-router-dom'; +import { useHistory } from 'react-router-dom'; import PropTypes from 'prop-types'; import pluginId from '../../pluginId'; import DynamicComponentCard from '../DynamicComponentCard'; import Tooltip from './Tooltip'; -const DynamicComponent = ({ - componentUid, - history: { push }, - setIsOverDynamicZone, -}) => { +const DynamicComponent = ({ componentUid, setIsOverDynamicZone }) => { const [state, setState] = useState(false); + const { push } = useHistory(); + const handleMouseEvent = () => { setIsOverDynamicZone(v => !v); setState(v => !v); @@ -35,10 +33,7 @@ const DynamicComponent = ({ DynamicComponent.propTypes = { componentUid: PropTypes.string.isRequired, - history: PropTypes.shape({ - push: PropTypes.func.isRequired, - }), setIsOverDynamicZone: PropTypes.func.isRequired, }; -export default withRouter(DynamicComponent); +export default DynamicComponent; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js b/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js index 7853e75e80..748323071c 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DynamicZone/index.js @@ -1,5 +1,4 @@ import React, { useCallback, useState } from 'react'; - import { get } from 'lodash'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl';