1.1.2 • Published 15 days ago

@doochik/babel-plugin-transform-react-componentdidcatch v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
15 days ago

@doochik/babel-plugin-transform-react-componentdidcatch

Adds componentDidCatch to every React.(Pure)Component

Installation

npm install --save-dev @doochik/babel-plugin-transform-react-componentdidcatch

Usage

You should enable this plugin only for client build

.babelrc

{
    "plugins": [
        ["@doochik/babel-plugin-transform-react-componentdidcatch", {
             "componentDidCatchHandler": "./path/to/my/componentDidCatchHandler.js"
        }]
    ]
}

Options

componentDidCatchHandler

Path to your errorHandler module. This is simple function with two arguments (error, errorInfo)

// componentDidCatchHandler.js

module.exports = (error, errorINfo) => {
   // here you can log error and return fallback component or null.
}
1.1.0

15 days ago

1.1.2

15 days ago

1.0.1

6 years ago

1.0.0

6 years ago