@wordpress/server-side-render
Version:
The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.
32 lines • 1.27 kB
TypeScript
import type { ServerSideRenderProps, ServerSideRenderWithPostIdProps } from './types';
export declare function ServerSideRender(props: ServerSideRenderProps): import("react").JSX.Element;
/**
* A component that renders server-side content for blocks.
*
* Note: URL query will include the current post ID when applicable.
* This is useful for blocks that depend on the context of the current post for rendering.
*
* @example
* ```jsx
* import { ServerSideRender } from '@wordpress/server-side-render';
* // Legacy import for WordPress 6.8 and earlier
* // import { default as ServerSideRender } from '@wordpress/server-side-render';
*
* function Example() {
* return (
* <ServerSideRender
* block="core/archives"
* attributes={ { showPostCounts: true } }
* urlQueryArgs={ { customArg: 'value' } }
* className="custom-class"
* />
* );
* }
* ```
*
* @param props Component props.
* @param props.urlQueryArgs Additional query arguments to append to the request URL.
* @return The rendered server-side content.
*/
export declare function ServerSideRenderWithPostId({ urlQueryArgs, ...props }: ServerSideRenderWithPostIdProps): import("react").JSX.Element;
//# sourceMappingURL=server-side-render.d.ts.map