react-load-script
react-load-script copied to clipboard
How to *not* load a script if it's already loaded...
Working on an React App, trying to get Paypal SDK to work.
The initial load works fine, but if the user navigates away from the page and back, things fail:
Error: Expected element to be passed to render iframe
How can you conditionally load the script, so that it's only loaded once based on the existence of window.paypal?
I've tried various conditionals in handleScriptCreate and handleScriptLoad, but I've not found the secret sauce.
Any advice would be appreciated.