2.0.4 • Published 3 years ago

@wedgekit/error-boundary v2.0.4

Weekly downloads
118
License
MIT
Repository
-
Last release
3 years 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

3 years ago

2.0.0-tc.3

4 years ago

2.0.0-tc.2

4 years ago

2.0.0-tc.1

4 years ago

2.0.0-tc.0

4 years ago

2.0.0-tc.7

4 years ago

2.0.0-tc.6

4 years ago

2.0.0-tc.5

4 years ago

2.0.0-tc.4

4 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.0-tc.8

4 years ago

2.0.1

3 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.1-tc.0

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.4-tc.1

5 years ago

0.0.3

5 years ago

0.0.2-tc.2

5 years ago

0.0.2-tc.1

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

6 years ago

0.0.0-tc.30

6 years ago

0.0.0-tc.29

6 years ago

0.0.0-tc.28

6 years ago

0.0.0-tc.27

6 years ago

0.0.0-tc.26

6 years ago

0.0.0-tc.25

6 years ago

0.0.0-tc.24

6 years ago

0.0.0-tc.23

6 years ago

0.0.0-tc.22

6 years ago

0.0.0-tc.21

6 years ago

0.0.0-tc.20

6 years ago

0.0.0-tc.19

6 years ago

0.0.0-tc.18

6 years ago

0.0.0-tc.17

6 years ago

0.0.0-tc.16

6 years ago

0.0.0-tc.15

6 years ago

0.0.0-tc.14

6 years ago

0.0.0-tc.13

6 years ago

0.0.0-tc.12

6 years ago

0.0.0-tc.11

6 years ago

0.0.0-tc.10

6 years ago

0.0.0-tc.9

6 years ago

0.0.0-tc.8

6 years ago

0.0.0-tc.7

6 years ago

0.0.0-tc.6

6 years ago

0.0.0-tc.5

6 years ago

0.0.0-tc.4

6 years ago

0.0.0-tc.3

6 years ago

0.0.0-tc.2

6 years ago

0.0.0-tc.1

6 years ago

0.0.0-tc.0

6 years ago