airbnb / react-with-styles

Use CSS-in-JavaScript with themes for React without being tightly coupled to one implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use performance.mark() and performance.measure() in development

lencioni opened this issue · comments

It would be nice to have more insight into how react-with-styles is performing in real world applications. We can use performance.mark() and performance.measure() to annotate the user timing pane in Chrome's performance devtool.

We could maybe surround them in an env var so they get compiled out by default? We'll also have to make sure to always surround them in if (typeof performance !== 'undefined') since this code tends to run on the server too.

Yes, absolutely. This should be contained in conditionals like:

if (process.env.NODE_ENV !== 'production') {
  ...
}