React Fetch Imgs

componentDidMount(){ var self = this; //console.log("member list "+JSON.stringify(this.state.memberList)+" Split Menu "+JSON.stringify(this.state.splitMenu)) userListRef.on("value",async (snapshot)=>{ let newState=[] const userList = snapshot.val() const userId = snapshot.key for(let user in userList){ try{ const urlCall = await fetch('') const response = await urlCall.json() newState.push({ id : user, urlImg:response[0].url, userName :userList[user].userName, userBudget:userList[user].userBudget, sorteado : false }) }catch (err){ console.log("error: ",err) } } this.setState({ integrantes:newState }) }) } //Componente Child {this.state.showIntegrantesList ? <IntegrantesList showIntegrantesList={this.state.showIntegrantesList} removeUser={this.removeUser} membersList={this.state.integrantes} />:null}

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.