Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 473 Bytes

readme.md

File metadata and controls

18 lines (13 loc) · 473 Bytes

useScript

The useScript hook allows you to load dynamic script tags on the page from within your react application. This is useful for things like form / video embeds where the script url may include a specific identifier.

Usage

function BlockEdit( props ) {
    const { attributes } = props;
    const { formId } = attributes;

    const { hasLoaded, scriptElement } = useScript( `https://example.com/${formId}` );

    return (
        ...
    );
}