Hacker News new | past | comments | ask | show | jobs | submit login
Anyone knows how to access React.js components through a Greasemonkey script?
2 points by EvanZimmer on June 15, 2021 | hide | past | favorite | 4 comments
I'm using a userscript to do some automations on a site that's running react.js, and things are super weird with the whole virtual dom and stuff. Can't even set a textfield value without react.js re rendering and deleting the inputs. Very confusing, much help would be appreciated from a Gresemonkey OG



a lot of use of MutationObservers to deal with re-rendering, & writing capture-phase event-listeners that modify events (or dispatch your own) rather than directly modifying form elements.

react is really an extremely difficult frustrating experience to hack up. really quite aggravating to modify. even with dev tools, react is still a huge anti-agency-stick in the mud & it's quite sad what a drain it is on the web.


I have made some spaghetti hacks so far, using this little library I've found https://github.com/vitalyq/react-trigger-change , that are able to invoke focus and some input changes calling the dispatchevent. But it's very unstable to say the least! like a setinterval I have will stop midway and run again, like complete crazy. I'm trying to put some input text to a component that I suspect is made with draft.js, and sometimes the input will go in, other times it wont, ot it will be just scribbles.


Hi GreaseMonkeyOG - Did you check the jquery library? [for options that cant be done in js] ~LAdyK


yeah, been using jq for ages, unfortunately jq modifies the dom, not the virtual dom react.js is running on




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: