Skip to content

Commit c789e56

Browse files
Mamadukaartemiomorales
authored andcommitted
Tag Cloud: Replace 'withSelect' HoC with 'useSelect' (#57194)
1 parent 2266df4 commit c789e56

File tree

1 file changed

+7
-7
lines changed
  • packages/block-library/src/tag-cloud

1 file changed

+7
-7
lines changed

packages/block-library/src/tag-cloud/edit.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
1414
Disabled,
1515
} from '@wordpress/components';
16-
import { withSelect } from '@wordpress/data';
16+
import { useSelect } from '@wordpress/data';
1717
import { __ } from '@wordpress/i18n';
1818
import {
1919
InspectorControls,
@@ -40,7 +40,7 @@ const MAX_TAGS = 100;
4040
const MIN_FONT_SIZE = 0.1;
4141
const MAX_FONT_SIZE = 100;
4242

43-
function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
43+
function TagCloudEdit( { attributes, setAttributes } ) {
4444
const {
4545
taxonomy,
4646
showTagCounts,
@@ -53,6 +53,10 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
5353
const units = useCustomUnits( {
5454
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem' ],
5555
} );
56+
const taxonomies = useSelect(
57+
( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),
58+
[]
59+
);
5660

5761
const getTaxonomyOptions = () => {
5862
const selectOption = {
@@ -174,8 +178,4 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
174178
);
175179
}
176180

177-
export default withSelect( ( select ) => {
178-
return {
179-
taxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),
180-
};
181-
} )( TagCloudEdit );
181+
export default TagCloudEdit;

0 commit comments

Comments
 (0)