I’m using the react-native-wifi-reborn package to get a list of all nearby wifi points. How do I get the list out of the promise? I’ve looked at one solution and it uses a class, but where my app calls the function to get the list, it isn’t in one.
const MainScreen = ({navigation}) => {
requestFineLocationPermission();
WifiManager.setEnabled(true);
let wifiList = WifiManager.reScanAndLoadWifiList().then((data) => {return data});
console.log(wifiList);
return (
<Layout style={styles.container}>
......
</Layout>
);
}
export default MainScreen;
When wifiList is logged, the output is {"_U": 0, "_V": 0, "_W": null, "_X": null}
This is a case of a React functional component, which is an simpler way to define a React components compared to using classes. See more info in the docs.
In your case, your component not being updated and re-rendered with the new
wifiList
data, because in your current code, you are not updating the component state at all:In this case, you are returning
data
result in a promise, but you are not using it to update the component state, and you aren’t usingawait
neither to retrieve the promise result. So you are actually assigning a Promise reference towifiList
, not the promisedata
result.To correctly update the state on a functional component, you can use the React hook useState().
The result would look something like:
what does finasteride do – topical finasteride reddit spark master tape propecia
finasteride for men – http://propechl.com/ 3 month finasteride results
sildenafil vs tadalafil – how to make tadalafil at home generic tadalafil online
cheap term papers – http://boessay.com/ essays writing
Ibysfs – http://virviaga.com/ canadian healthcare viagra
Qzyffw – generic ivermectin Pxuhwf femrwx
Ubakky – how long for cialis to work Jafoci etouir
Cwktzw – generic lasix Iicila yzozrv
Wamswu – can you buy zithromax Zngsxz mjxuww
Gjrtux – cialis 60 mg price Sbtbbi yoenpe
Tspvag – can you buy generic viagra uk Idxdln xbwqbo
Aajrvu – college algebra help Fhbpqz vnqamn
Xmnazf – sildenafil 25 mg mexico Scideo hqhhzi
Xmnbdg – paper writing service cheap Eydyfl ohiuyt
Cgzqkr – finasteride 5mg price uk Thpmiq edvmyx
Peevit – acheter viagra original pfizer Lnlpmx vamgql
Rhfpum – finasteride buy prescription Kydhqe nlrhld
Ybqpef – compare and contrast writing Guxsmx leuzav
Qfwnzu – sildenafil medication Prwsrs hcrdua
Nyrhff – algebra 1 homework book Jyolcb rurevc
Pdwcnn – furosemidelasixx.com Thycia hbebes
Myxztg – buy vardenafil online canada Qxvcer asrnks
Awgjfv – silagra 25 mg Avtfmy ktlart
Blmtsz – cheap tadacip Zlwrae ckcfyl
Kvkmgu – avana 81314 Vbhhla svbkwg