dozoisch / dozoisch/react-async-script

How do you pass params to the URL?

オープン
#38 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
JavaScript
スター
177
フォーク
29
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず AsyncScriptLoader API と、issue に示されている WrapperComponent の使用方法を読み、URL、callbackName、globalName がどのように渡されているかに注目します。Props が URL の構築にどのように到達し得るか、また複数のラップされたインスタンスがコールバックをどのように共有するかを追跡します。issue の動的 URL パラメーターと複数インスタンスに関する懸念が、文書化されテストされた形で解決されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
frontend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。