react-amiga-guru-meditation
Version:
A React Error Boundary styled like the Amiga Guru Meditation
56 lines (37 loc) • 1.14 kB
text/mdx
name: AmigaErrorBoundary
route: /components/amigaerrorboundary
menu: Components
import { Playground, Props } from 'docz'
import AmigaErrorBoundary from '../../../src/components/AmigaErrorBoundary'
import {AmigaErrorBoundaryExample} from './AmigaErrorBoundaryExample'
# AmigaErrorBoundary
You may use the `AmigaErrorBoundary` as a ErrorBoundary
## Basic usage
```jsx
<AmigaErrorBoundary>
... your components
</AmigaErrorBoundary>
````
<Playground>
<AmigaErrorBoundary show={false} error={"Hello, I'm error"}>
<p>Set true the show prop</p>
</AmigaErrorBoundary>
</Playground>
Of course, you may use it to display any catchable error in your children components
```jsx
<AmigaErrorBoundary show={true} error={"Hello, I'm error"}>
... your components
</AmigaErrorBoundary>
````
You may also change the appearance
<Playground>
<AmigaErrorBoundary show={false} error={"Hello, I'm error"} color="#f90" backgroundColor="#a00">
<p>Set true the show prop and change the color</p>
</AmigaErrorBoundary>
</Playground>
## Example
<AmigaErrorBoundaryExample />
## Props
<Props of={AmigaErrorBoundary} />