Skip to content

Commit

Permalink
List View: Use default parameters instead of defaultProps (#46266)
Browse files Browse the repository at this point in the history
* List View: Use default parameters instead of defaultProps

* Use 'noop' with a stable reference

* Remove duplicate comment
  • Loading branch information
Mamaduka authored Dec 2, 2022
1 parent 9850eec commit 8776171
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
11 changes: 3 additions & 8 deletions packages/block-editor/src/components/list-view/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import { memo } from '@wordpress/element';
import { AsyncModeProvider, useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
Expand Down Expand Up @@ -79,10 +76,12 @@ const countReducer =
return count + 1;
};

const noop = () => {};

function ListViewBranch( props ) {
const {
blocks,
selectBlock,
selectBlock = noop,
showBlockMovers,
selectedClientIds,
level = 1,
Expand Down Expand Up @@ -215,8 +214,4 @@ function ListViewBranch( props ) {
);
}

ListViewBranch.defaultProps = {
selectBlock: () => {},
};

export default memo( ListViewBranch );
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ const countReducer =
return count + 1;
};

const noop = () => {};

function ListViewBranch( props ) {
const {
blocks,
selectBlock,
selectBlock = noop,
showBlockMovers,
selectedClientIds,
level = 1,
Expand Down Expand Up @@ -203,8 +205,4 @@ function ListViewBranch( props ) {
);
}

ListViewBranch.defaultProps = {
selectBlock: () => {},
};

export default memo( ListViewBranch );

0 comments on commit 8776171

Please sign in to comment.