File "with-props.js"
Full path: /home/satitravel/public_html/plugins/better-wp-security/core/packages/hocs/src/with-props.js
File
size: 561 B
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
/**
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { createHigherOrderComponent } from '@wordpress/compose';
/**
* Higher-order component that applies props to the inner component.
*
* @param {Object} props
*
* @return {WPComponent} Debounced component.
*/
export default function withProps( props ) {
return createHigherOrderComponent( ( WrappedComponent ) => {
return class Wrapper extends Component {
render() {
return <WrappedComponent { ...this.props } { ...props } />;
}
};
}, 'withProps' );
}