Skip to content

Commit

Permalink
Block Editor: Use hooks instead of HoC in 'MultiSelectionInspector' (W…
Browse files Browse the repository at this point in the history
…ordPress#64634)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored and bph committed Aug 31, 2024
1 parent ae74ec0 commit ccc74eb
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { sprintf, _n } from '@wordpress/i18n';
import { withSelect } from '@wordpress/data';
import { useSelect } from '@wordpress/data';
import { serialize } from '@wordpress/blocks';
import { count as wordCount } from '@wordpress/wordcount';
import { copy } from '@wordpress/icons';
Expand All @@ -13,7 +13,13 @@ import { copy } from '@wordpress/icons';
import BlockIcon from '../block-icon';
import { store as blockEditorStore } from '../../store';

function MultiSelectionInspector( { blocks } ) {
export default function MultiSelectionInspector() {
const { blocks } = useSelect( ( select ) => {
const { getMultiSelectedBlocks } = select( blockEditorStore );
return {
blocks: getMultiSelectedBlocks(),
};
}, [] );
const words = wordCount( serialize( blocks ), 'words' );

return (
Expand All @@ -38,10 +44,3 @@ function MultiSelectionInspector( { blocks } ) {
</div>
);
}

export default withSelect( ( select ) => {
const { getMultiSelectedBlocks } = select( blockEditorStore );
return {
blocks: getMultiSelectedBlocks(),
};
} )( MultiSelectionInspector );

0 comments on commit ccc74eb

Please sign in to comment.