rescript-react-error-boundary

1.0.0 • Public • Published

rescript-react-error-boundary

NPM Package LICENSE - MIT

ReScript binding for react-error-boundary

Installation

yarn add rescript-react-error-boundary

And add it into your bsconfig.json

  "bs-dependencies": [
    "rescript-react-error-boundary"
  ]

Example

open RescriptReactErrorBoundary;

@react.component
let make = () => {
  <div>
    <ErrorBoundary
      onError={(error, _) =>
        Js.Console.error(
          switch (error->Js.Exn.message) {
          | Some(message) => message
          | None => "Unknown error occured while rendering"
          },
        )
      }>
      <App/>
    </ErrorBoundary>
  </div>;
};

LICENSE

MIT

Package Sidebar

Install

npm i rescript-react-error-boundary

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.91 kB

Total Files

4

Last publish

Collaborators

  • cometkim