我想知道以下代码的最后一部分是否正确。
我的意思是,不是必须是“withInspectorControls”而不是“withInspectorControl”吗?以“s”结尾。
const withInspectorControls = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
return (
<Fragment>
<BlockEdit { ...props } />
<InspectorControls>
<PanelBody>My custom control</PanelBody>
</InspectorControls>
</Fragment>
);
};
}, 'withInspectorControl' );
手册中此代码的“普通版”以“withInspectorControls”结尾。
var withInspectorControls = wp.compose.createHigherOrderComponent( function (
BlockEdit
) {
return function ( props ) {
return el(
wp.element.Fragment,
{},
el( BlockEdit, props ),
el(
wp.blockEditor.InspectorControls,
{},
el( wp.components.PanelBody, {}, 'My custom control' )
)
);
};
},
'withInspectorControls' );
我想知道,因为这段代码适用于“withInspectorControls”或“withInspectorControl”,并且想知道这是怎么回事。