2.0.4 • Published 1 year ago

@wedgekit/error-boundary v2.0.4

Weekly downloads
118
License
MIT
Repository
-
Last release
1 year ago

ErrorBoundary

Purpose

The error boundary is a wrapper around a component or a group of components. An error boundary will catch errors and present them to the user in a fallback UI. Typically, an error boundary should be used at the root of an application. More reading on error boundaries may be found here

Usage

import Button from '@wedgekit/button';
import ErrorBoundary from '@wedgekit/error-boundary';

const ErrorButton = () => {
  const [error, setError] = React.useState(false);

  React.useEffect(() => {
    if (error) {
      throw new Error('User created error');
    }
  }, [error]);
  return <Button onClick={() => setError(true)}>Throw Error</Button>;
};

const Example = () => {
  return (
    <ErrorBoundary title="Error Title" message="Error Message">
      <h1>No errors</h1>
      <ErrorButton />
    </ErrorBoundary>
  );
};

render(<Example />);

Props

children

Type: JSX.Element

Required: ✅

The component(s) ErrorBoundary is to wrap.

message

Type: string

Required: ✅

A standard error message used to portray information to the user.

title

Type:string

Required: ✅

A standard title used to inform the user that an error has occurred.

2.0.4

1 year ago

2.0.0-tc.3

2 years ago

2.0.0-tc.2

2 years ago

2.0.0-tc.1

2 years ago

2.0.0-tc.0

2 years ago

2.0.0-tc.7

2 years ago

2.0.0-tc.6

2 years ago

2.0.0-tc.5

2 years ago

2.0.0-tc.4

2 years ago

2.0.3

1 year ago

2.0.2

2 years ago

2.0.0-tc.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.1-tc.0

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.4-tc.1

3 years ago

0.0.3

3 years ago

0.0.2-tc.2

3 years ago

0.0.2-tc.1

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago

0.0.0-tc.30

4 years ago

0.0.0-tc.29

4 years ago

0.0.0-tc.28

4 years ago

0.0.0-tc.27

4 years ago

0.0.0-tc.26

4 years ago

0.0.0-tc.25

4 years ago

0.0.0-tc.24

4 years ago

0.0.0-tc.23

4 years ago

0.0.0-tc.22

4 years ago

0.0.0-tc.21

4 years ago

0.0.0-tc.20

4 years ago

0.0.0-tc.19

4 years ago

0.0.0-tc.18

4 years ago

0.0.0-tc.17

4 years ago

0.0.0-tc.16

4 years ago

0.0.0-tc.15

4 years ago

0.0.0-tc.14

4 years ago

0.0.0-tc.13

4 years ago

0.0.0-tc.12

4 years ago

0.0.0-tc.11

4 years ago

0.0.0-tc.10

4 years ago

0.0.0-tc.9

4 years ago

0.0.0-tc.8

4 years ago

0.0.0-tc.7

4 years ago

0.0.0-tc.6

4 years ago

0.0.0-tc.5

4 years ago

0.0.0-tc.4

4 years ago

0.0.0-tc.3

4 years ago

0.0.0-tc.2

4 years ago

0.0.0-tc.1

4 years ago

0.0.0-tc.0

4 years ago