dozoisch / dozoisch/react-async-script

How do you pass params to the URL?

Open
#38 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
177
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Hi,

In the example shown, the URL is known upfront and hardcoded. Is it possible to pass in props into the wrapper that helps determine what the URL is and then inject that URL being used?

In my use case, bing maps api, I need to add in query params to set the Language or local.

example of what i'm looking for.

Then in the WrapperComponent it takes the url props and builds the URL that is injected into the default.

export default AsyncScriptLoader(BingMapWidget, URL, {
callbackName: callbackName,
globalName: globalName,
});

However, its not clear to me if it's possible to expose the wrapper to take in those params so then i can run a method to compute the URL and spit it back to the AsyncScriptLoader

Also i notice that you are attaching to the global scope. What happens if you launch two instances of the wrapped components. Would there be issues since they will share the same callback?

Thanks,
Derek

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.