How to use the @wordpress/element.render function in @wordpress/element

To help you get started, we’ve selected a few @wordpress/element 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 htmlburger / carbon-fields / packages / metaboxes / containers / index.js View on Github external
export function renderContainer( container, context ) {
	const node = document.querySelector( `.container-${ container.id }` );
	const Component = getContainerType( container.type, context );

	if ( node ) {
		render(
			,
			node,
			() => {
				node.dataset.mounted = true;
			}
		);
	} else {
		// eslint-disable-next-line no-console
		console.error( sprintf( __( 'Could not find DOM element for container "%1$s".', 'carbon-fields-ui' ), container.id ) );
	}
}
github gambitph / Stackable / src / help / index.js View on Github external
domReady( () => {
	// Don't do this for old browsers.
	if ( ! Element.prototype.closest ) {
		return
	}

	const helpContainer = document.createElement( 'DIV' )
	document.querySelector( 'body' ).appendChild( helpContainer )
	render( , helpContainer )
} )
github Yoast / wordpress-seo / js / src / help-scout-beacon.js View on Github external
function renderComponent( Component ) {
	const element = document.createElement( "div" );
	element.setAttribute( "id", "yoast-helpscout-beacon" );

	render( , element );

	document.body.appendChild( element );
}
github htmlburger / carbon-fields / packages / metaboxes / monitors / index.js View on Github external
export default function initializeMonitors( context ) {
	const { pagenow } = window.cf.config;

	render(
		
			{ ! isGutenberg() && (
				
			) }

			{ ( pagenow === PAGE_NOW_WIDGETS || pagenow === PAGE_NOW_CUSTOMIZE ) && (
				
			) }

			
		,
		document.createElement( 'div' )
	);

	const postStuffNode = document.querySelector( '#poststuff' );
github WordPress / gutenberg / packages / edit-widgets / src / index.js View on Github external
export function initialize( id, settings ) {
	registerCoreBlocks();
	render(
		,
		document.getElementById( id )
	);
}
github ampproject / amp-wp / assets / src / stories-editor / helpers / renderStoryComponents.js View on Github external
const storyControls = document.createElement( 'div' );
			storyControls.id = 'amp-story-controls';

			ampStoryWrapper.appendChild( storyControls );

			render(
				,
				storyControls,
			);
		}

		ampStoryWrapper.appendChild( editorBlockList );

		ampStoryWrapper.appendChild( blockNavigation );

		render(
			,
			blockNavigation,
		);

		if ( ! document.getElementById( 'amp-story-editor-carousel' ) ) {
			const editorCarousel = document.createElement( 'div' );
			editorCarousel.id = 'amp-story-editor-carousel';

			ampStoryWrapper.appendChild( editorCarousel );

			render(
				,
				editorCarousel,
			);
		}
	}
github Automattic / newspack-plugin / assets / wizards / handoff-banner / index.js View on Github external
)
		);
	}
}

HandoffBanner.defaultProps = {
	primaryButtonText: __( 'Back to Newspack' ),
	dismissButtonText: __( 'Dismiss' ),
	primaryButtonURL: '/wp-admin/admin.php?page=newspack',
	bodyText: __( 'Click to return to Newspack after completing configuration' ),
};

const el = document.getElementById( 'newspack-handoff-banner' );
const { primary_button_url: primaryButtonURL } = el.dataset;
render(
	createElement( HandoffBanner, {
		primaryButtonURL,
	} ),
	el
);
github WordPress / gutenberg / packages / edit-site / src / index.js View on Github external
export function initialize( id, settings ) {
	registerCoreBlocks();
	if ( process.env.GUTENBERG_PHASE === 2 ) {
		__experimentalRegisterExperimentalCoreBlocks( settings );
	}
	render( , document.getElementById( id ) );
}
github Yoast / wordpress-seo / js / src / helpers / classicEditor.js View on Github external
export function renderClassicEditorMetabox( store ) {
	const localizedData = getL10nObject();
	containerRef = createRef();

	const theme = {
		isRtl: localizedData.isRtl,
	};

	render(
		(
			
				
				
			
		),
		document.getElementById( "wpseo-metabox-root" )
	);

	registeredComponents.forEach( ( registered ) => {
		containerRef.current.registerComponent( registered.key, registered.Component );
	} );
github htmlburger / carbon-fields / packages / metaboxes / monitors / index.js View on Github external
) }

			{ ( pagenow === PAGE_NOW_WIDGETS || pagenow === PAGE_NOW_CUSTOMIZE ) && (
				
			) }

			
		,
		document.createElement( 'div' )
	);

	const postStuffNode = document.querySelector( '#poststuff' );

	if ( postStuffNode ) {
		render( , postStuffNode.appendChild( document.createElement( 'div' ) ) );
	}
}