Skip to content

Instantly share code, notes, and snippets.

@prozacgod
Last active November 7, 2019 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prozacgod/e1aad87eb8aa835ff257081cad7f9d88 to your computer and use it in GitHub Desktop.
Save prozacgod/e1aad87eb8aa835ff257081cad7f9d88 to your computer and use it in GitHub Desktop.
Testing react bug with dev libraries not working in tampermonkey environment.
// ==UserScript==
// @name Test react bug with dev module
// @version 0.1
// @description React Development
// @author Prozacgod
// @match http://localhost:8080/
// @grant unsafeWindow
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// Works with these
// @require https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.development.js
// @require https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.2/umd/react-dom.development.js
// // @require https://cdnjs.cloudflare.com/ajax/libs/react/16.10.2/umd/react.production.min.js
// // @require https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.10.2/umd/react-dom.production.min.js
// Crashes/Infinite loops in different ways with 16.5.2 and onward (development versions)
// // @require https://cdnjs.cloudflare.com/ajax/libs/react/16.10.2/umd/react.development.js
// // @require https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.10.2/umd/react-dom.development.js
// ==/UserScript==
(function() {
'use strict';
let elem = document.getElementById('testing-element');
if (!elem) {
elem = document.createElement('div');
elem.id = 'testing-element';
document.body.appendChild(elem);
}
ReactDOM.render(React.createElement('div', {}, ["Foo!"]), elem);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment