/rescript-react-error-boundary

ReScript binding for react-error-boundary

Primary LanguageReScriptMIT LicenseMIT

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