-
Notifications
You must be signed in to change notification settings - Fork 48.6k
Request: Better documentation of react-addons-perf #6174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Agreed it’s not great. These APIs aren’t meant to be used from code (at least, not commonly). They are mostly meant to be used from DevTools console. These two articles are really great at explaining how you can use them:
ReactPerf is going to change somewhat (#6046) so it would probably be unwise to spend more time documenting the right now. |
Is that the type of code example you are looking for? Or what would be a code example that you would want? Also, @gaearon Those links are great, I'd be totally ok with linking to those docs until we release the new react perf stuff. |
@gaearon Wow, awesome links! Bookmarking those, thank you. What was missing for me (from the official Facebook docs) was where exactly to put the perf calls. Console? Code? Where exactly in the code? |
Ok, I feel like a n00b. How do I access these tools in the Chrome console? |
@ffxsam The easiest way is to use the bower builds:
|
Yeah, that route won't work for me as I'm using Meteor which doesn't use |
To clarify: I have React installed via npm, and used throughout my project. I have a full Meteor/React/Redux project already up and running. I just need to know how to use the perf tools. |
I usually do this (in development only!): if (process.env.NODE_ENV !== 'production') {
window.ReactPerf = require('react/addons').addons.ReactPerf
} somewhere in my Again, agreed it’s far from nice, and we need a better story around this. |
Yep, that's what I was going to try next, and that worked. Thanks again! |
yes please, going in circles here between deprecated modules and modules that just cycle back to the bad docs haha, and the react-addons-perf module apparently does not exist once installed |
You haven't seen bad docs till you've been to the webpack page. :) |
would be sweet to have it integrated right in the chrome dev tools, unless someone is already working on that :D |
Yeah, that’s the longer term plan. |
Temporary solution until new react perf is released. Ref facebook#6174
Can you clarify? I was able to run
then put window.ReactPerf = require('react-addons-perf') in my |
For me personally, this worked:
|
hmm weird must have been something funky with webpack |
You might want to verify you don’t have a duplicate React. Maybe there was some version issue and you got a duplicate one? |
Yes, although AFAIK some
The operation name is misleading because it’s actually using |
If you're using Browserify and just want to utilize this from the console without changing your app code you can do window.whatever = require("react-addons-perf"); A pain in the neck to be sure, but it's one option for using it currently. Alternatively you could, just in dev, include an additional entry file (from disk or stream) that sets it as a global, e.g.: if (environment !== "production") b.add("dev-init.js"); |
Hi @tj
I had problems with that too. I'm going to explain what I did, just in case we were in the same scenario or maybe it's useful for someone else. I was using Other solution could be use |
Oh.. I should mention I'm using version 15.1.0. |
Make sure you have both |
Closing in favor of an umbrella issue in #8060. |
Is there any way how to print measurement to DOM, like a simple text, because of i don't have any access to console.. |
react-addons-perf working on react version 16(.1)? Stackflow's documentation is stating otherwise..... |
|
https://facebook.github.io/react/docs/perf.html
IMO this is insufficient. Where are we supposed to place each of the API calls? Some example code would be great.
The text was updated successfully, but these errors were encountered: