Gatsby plugin to include @welldone-software/why-did-you-render
npm install gatsby-plugin-why-did-you-renderInclude the @welldone-software/why-did-you-render library when running gatsby develop.
This plugin can be replicated by adding @welldone-software/why-did-you-render as a dependency, and adding the
following code to your gatsby-browser.js:
``js
import React from 'react'
export const onClientEntry = () => {
if (process.env.NODE_ENV !== 'production') {
const whyDidYouRender = require('@welldone-software/why-did-you-render')
whyDidYouRender(React, {
trackAllPureComponents: true
})
}
}
`
You're probably better off doing that and retaining more control of the version of WDYR that gets installed. However, if
you want to continue...
Using npm:
``
npm i gatsby-plugin-why-did-you-render
Using yarn:
``
yarn add gatsby-plugin-why-did-you-render
```
// In your gatsby-config.js
module.exports = {
plugins: ['gatsby-plugin-why-did-you-render']
};