I created an app with Create React App.
How can I add global debug functions (e.g. resetDatabase()
) that I can call from Chromes Debug Console (or some other way)?
I created an app with Create React App.
How can I add global debug functions (e.g. resetDatabase()
) that I can call from Chromes Debug Console (or some other way)?
You can attach the function to the global window object, or some namespaced object.
Then in the console you can run it with:
window.resetDatabase();
Here’s a link to a relevant post about accessing the global context through the componentWillMount callback.
Refer this site -: IT gives you the complete guide for that or if you face any issue feel free to ask https://developers.google.com/web/tools/chrome-devtools/console/