dozoisch / dozoisch/react-async-script

How do you pass params to the URL?

Aperta
#38 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
JavaScript
Stelle
177
Fork
29
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.