import { FunctionComponent, useState } from 'react'; import { Title, Button, Card, CardBody, CardFooter, CardHeader } from '@patternfly/react-core'; import ErrorBoundary from '@patternfly/react-component-groups/dist/dynamic/ErrorBoundary'; export const BasicExample: FunctionComponent = () => { const [ hasError, setHasError ] = useState(false); const Surprise = () => { if (hasError) { throw new Error('but a welcome one'); } return ( Demo content wrapped in error boundary This is a demo content that may throw an error: ); }; return ( <> {hasError && ( )} ); };