Skip to content

How to *not* load a script if it's already loaded... #32

@kimfucious

Description

@kimfucious

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions