hcomp
Version:
HComp is a helper component library that aims to improve code readability and make your life easier.
21 lines (20 loc) • 711 B
TypeScript
import React from "react";
import { ICaseProps } from "../../../shared/index.types";
/**
* A component that conditionally renders content based on the `when` prop, and you can use it inside Switch component as Switch.Case
*
* When `when` is `true`, it renders the `children` prop.
*
* @example
* ```tsx
* <Switch.Case when={condition}>
* <Content />
* </Switch.Case>
* ```
*
* @param when - Determines whether to show or hide the content.
* @param children - The content to be displayed when `when` is `true`.
* @returns The rendered content based on the `when` prop.
*/
declare const Case: ({ when, children }: ICaseProps) => React.JSX.Element | null;
export default Case;