How to use the @wordpress/components.withFocusReturn function in @wordpress/components

To help you get started, we’ve selected a few @wordpress/components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / wordpress__components / wordpress__components-tests.tsx View on Github external
(() => {
    const EnhancedComponentDefaultBehavior = C.withFocusReturn((props: { foo: string; bar: string }) => (
        <div>{JSON.stringify(props)}</div>
    ));
    ;

    const EnhancedComponentCustomBehavior = C.withFocusReturn({
        onFocusReturn() {
            console.log('Hello World!');
        },
    })((props: { foo: string; bar: string }) =&gt; <div>{JSON.stringify(props)}</div>);
    ;

    const EnhancedComponentCustomBehaviorDefault = C.withFocusReturn({})((props: { foo: string; bar: string }) =&gt; (
        <div>{JSON.stringify(props)}</div>
    ));
    ;
})();