@wrdagency/react-islands
Version:
Created by Kyle Cooper at [WRD.agency](https://webresultsdirect.com)
49 lines (44 loc) • 1.23 kB
TypeScript
import { FC } from 'react';
interface IslandRenderOptions {
shouldHydrate: boolean;
multiple: boolean;
keepChildren: boolean;
}
interface IslandOpts extends Partial<IslandRenderOptions> {
}
declare class Island {
readonly component: React.FC;
readonly renderOptions: IslandRenderOptions;
constructor(component: React.FC, opts?: IslandOpts);
private getProps;
private getRoots;
render(name: string): void;
}
/**
* Create a higher-order component with certain fixed.
*
* Useful for quickly creating multiple variants of the same component to use as islands.
*
* @param component FC<T>
* @param setProps Partial<T>
* @returns FC<T>
*/
declare function withProps<T>(component: FC<T>, setProps: Partial<T>): FC<T>;
/**
* Checks if the current script is running in a pre-render.
*
* @returns boolean
*/
declare function isServer(): boolean;
type ConfigOptions = {
islands: Record<string, string>;
output: string;
minify?: boolean;
ssg?: boolean;
jsx?: "react" | "react-jsx" | "preserve" | "preserve-react";
typescript?: boolean;
common?: string[];
define?: Record<string, string>;
};
export { Island, isServer, withProps };
export type { ConfigOptions };