woocommerce/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-editing-image.js

21 lines
426 B
JavaScript

/**
* External dependencies
*/
import { useEffect, useState } from 'react';
export const withEditingImage = ( Component ) => ( props ) => {
const [ isEditingImage, setIsEditingImage ] = useState( false );
const { isSelected } = props;
useEffect( () => {
setIsEditingImage( false );
}, [ isSelected ] );
return (
<Component
{ ...props }
useEditingImage={ [ isEditingImage, setIsEditingImage ] }
/>
);
};