Skip to content

Commit

Permalink
add a section to readme about "no-classes-transpile"
Browse files Browse the repository at this point in the history
  • Loading branch information
vzaidman committed Jan 19, 2019
1 parent 29ecddd commit 183faae
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ if (process.env.NODE_ENV !== 'production') {
}
```

If you are building for latest browsers and don't transpile the "class" keyword use the "no-classes-transpile" dist:
```js
import React from 'react';

if (process.env.NODE_ENV !== 'production') {
const whyDidYouRender = require('@welldone-software/why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js');
whyDidYouRender(React);
}
```
Not doing so will [result in a bug](https://github.com/welldone-software/why-did-you-render/issues/5)
where a transpiled class tries to extend a native class:

`class constructors must be invoked with |new|`.


Then mark all the components you want to be notified about their re-renders with `whyDidYouRender` like so:

```js
Expand Down

0 comments on commit 183faae

Please sign in to comment.