How to write the variable s in state? How to write a variable in state as the key that contains snap.key from the database?
componentDidMount(){ 
    let cardQuantity = firebase.database().ref("Users"); 
    cardQuantity.on('child_added',snap => { 
        let cardsValue = cardQuantity.child(snap.key); 
        let cardId = {cardId : snap.key}; 
        this.setState({cardsId : [cardId].concat(this.state.cardsId)}); 
        let s = snap.key;
        this.setState({cards : []}); 
        cardsValue.on('value',snap => { 
            snap.forEach((childSnapshot)=> { 
                let card = {text: childSnapshot.val(), id: childSnapshot.key}; 
                //   this.setState({s : [card].concat(this.state.cards)}); 
            });
        }); 
    }) 
}
<div className="Info" > 
    { this.state.cardsId.map( cardsId => <div className="Cards" key={cardsId.cardId}> 
    //    {this.state.cards.map( card => <h2 key={card.id} >
    {card.text}</h2>) } 
</div>) }
 
     
     
    
{ card.text } < /h2>) }
– Илья Литвинцев Oct 29 '17 at 04:31