Preact: Do we still need tools like why-did-you-render?

Created on 19 Sep 2020  路  2Comments  路  Source: preactjs/preact

I'm new to Preact.

Long time ago I was using React and it was almost necessary to use this tool to speed everything up: https://github.com/welldone-software/why-did-you-render.

Today I started working with Preact for the first time and I was wondering if today we still need a tool like that.

And if so, how can we make it work for Preact?

From here it seems to me that nobody knows how: https://github.com/welldone-software/why-did-you-render/issues/113.

question

Most helpful comment

Hi there! Preact has its own developer tools that you can install as a browser extension:
https://preactjs.github.io/preact-devtools/

As for the "Why Did You Render" library, the reason there is no specific documentation on how to set it up with Preact is because it works out-of-the-box with preact/compat. Just set up the aliases and it'll print the same data it would for React.

Here's their codesandbox that I forked and dropped in the aliases on:
https://codesandbox.io/s/why-did-you-render-preact-6kcum?file=/package.json
(in the case of codesandbox the aliases are a little weird, normally it's {"react":"npm:@preact/compat"} or similar)

I'm going to close this one out since it's a question, but feel free to ask any further questions on Slack - Saturdays aren't as quick to get an answer, but it's generally a better avenue than GitHub for things like this.

All 2 comments

Hi there! Preact has its own developer tools that you can install as a browser extension:
https://preactjs.github.io/preact-devtools/

As for the "Why Did You Render" library, the reason there is no specific documentation on how to set it up with Preact is because it works out-of-the-box with preact/compat. Just set up the aliases and it'll print the same data it would for React.

Here's their codesandbox that I forked and dropped in the aliases on:
https://codesandbox.io/s/why-did-you-render-preact-6kcum?file=/package.json
(in the case of codesandbox the aliases are a little weird, normally it's {"react":"npm:@preact/compat"} or similar)

I'm going to close this one out since it's a question, but feel free to ask any further questions on Slack - Saturdays aren't as quick to get an answer, but it's generally a better avenue than GitHub for things like this.

As for the "Why Did You Render" library, the reason there is no specific documentation

Even better, it's included in our devtools extension as part of the Profiler. It will record why an update was triggered. See the following screenshot :+1:

Screenshot from 2020-09-19 22-50-24

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KnisterPeter picture KnisterPeter  路  3Comments

matthewmueller picture matthewmueller  路  3Comments

jasongerbes picture jasongerbes  路  3Comments

kay-is picture kay-is  路  3Comments

Zashy picture Zashy  路  3Comments