2
コード例では、Promise
オブジェクトの配列でsetState()
を呼び出しようとしています。データ(座標)は、外部のRESTサービスからフェッチする必要があります。状態をasync/awaitで設定してください
Reactでこれを行う一般的なパターンはありますか?
ANNOTATIONS: [Promise, Promise, Promise, Promise, Promise, Promise, Promise]
ExceptionsManager.js:70 Warning: Failed prop type: Required prop `annotations[0].latitude` was not specified in `MapView`.
in MapView (at index.js:204)
in SampleAppInspection (at renderApplication.ios.js:90)
in RCTView (at View.js:348)
in View (at renderApplication.ios.js:65)
in RCTView (at View.js:348)
in View (at renderApplication.ios.js:64)
in AppContainer (at renderApplication.ios.js:89)
https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop – Bergi