Nemo's Parental Misguidance

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

    1.0.1 • Public • Published

    Build Status

    @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.
    }

    Keywords

    none

    Install

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

    DownloadsWeekly Downloads

    8

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    25.5 kB

    Total Files

    13

    Last publish

    Collaborators

    • doochik