vite-plugin-react-control-statements
Version:
A Vite plugin for using React control statements
30 lines (26 loc) • 934 B
text/typescript
import { FunctionComponent, ReactNode } from 'react';
import { Plugin } from 'vite';
declare function reactControlStatements(): Plugin;
type IfProps = {
condition: boolean;
children: ReactNode;
};
type ChooseProps = {
children: ReactNode;
};
type WhenProps = {
condition: boolean;
children: ReactNode;
};
type OtherwiseProps = {
children: ReactNode;
};
/** Render conditionally based on the condition prop */
declare const If: FunctionComponent<IfProps>;
/** Container component for When/Otherwise components */
declare const Choose: FunctionComponent<ChooseProps>;
/** Render conditionally based on the condition prop inside a Choose component */
declare const When: FunctionComponent<WhenProps>;
/** Render conditionally as the default case inside a Choose component */
declare const Otherwise: FunctionComponent<OtherwiseProps>;
export { Choose, If, Otherwise, When, reactControlStatements as default };