babel-plugin-component-did-catch-source
Add fiber source to
componentDidCatch
info argument.
Installation
npm install --save-dev babel-plugin-component-did-catch-source
The Problem
Need access to the source fiber but react's componentDidCatch
does not provide it. Maintaining a fork of React is not as flexible as a compile time change.
Example
Before
{ }
After
{ const props state = sourcestateNode }
Usage
.babelrc.js
(Recommended)
Via .babelrc
Via CLI
babel --plugins component-did-catch-source script.js
Via Node
;
Options
None yet
Notes
This plugin will likely only work with v16 of React.
License
MIT