Change the state of component not working


Here’s my value transformer script for like button element’s state:

  let favorites=this.props.appActions.getDataSheet('userFavorites'); //get the user likes array. In my case it is in Data sheet containing user's all likes
  let userId=this.props.appActions.dataSlots['ds_SlotFirebaseUserId']; // user id
  let drinkId=input; // ID for current list item

 // loop trough the user likes array
  for (let i=0;i < favorites.items.length; i++){
  if (drinkId.toString()===favorites.items[i].drinkID && userId.toString()===favorites.items[i].userId){
    console.log("found favorite document id: " + favorites.items[i].document_key);
    favoritedocumentid=favorites.items[i].document_key; // like found return 1
    return 1;
  return 0;


In my case I also need to set the document id for Button component so I’ve added function which is then given as property to my Like button component.

Please note that my example is not optimized at all. I simply tested quickly and it probably makes many unnecessary reads to database.