class constructors must be invoked with |new|
See original GitHub issueTrying to implement base functionality on our existing React app.
Getting
class constructors must be invoked with |new|
for any component I add the static property to.
It looks like this is a common issue across this library and the predecessors, but I was under the impression this library had it solved, so I must be missing something.
I’ve attached the library via NPM as well as manually adding the src to see if I could narrow it down. Best I can tell the error is thrown here (line 505):
_this = _possibleConstructorReturn(this, _getPrototypeOf(WDYRPatchedClassComponent).call(this, props, context));
Excluding markup, my component looks like this: `class Home extends React.Component {
constructor(props) { super(props); } static whyDidYouRender = true; render(){ … } export default Home; `
Issue Analytics
- State:
- Created 5 years ago
- Comments:29
Top GitHub Comments
Same error here using the
create-react-app
3 and this import:const whyDidYouRender = require('@welldone-software/why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js')
.My browserlist:
Maybe you should re-open this issue.
fixed in v2.5.0.
If you are not transpiling your classes, the library should be built without class transpilations as well.
So we added 3 endpoints where it is indeed not transpiled:
to use it, import the library like this: