Here is some code I am working with:
const url = `https://the-cocktail-db.p.rapidapi.com/lookup.php?i=${action.id}`;
const { loading, data } = yield call(fetchData, url);
const { drinks } = data;
const [ details ] = drinks;
const { strDrink, strDrinkThumb, strInstructions, idDrink } = details;
const cocktail = { strDrink, strDrinkThumb, strInstructions, idDrink };
yield put(getCocktailDetails(cocktail, action.id, loading));
I'm looking for a way to streamline and shorten this code. Would formatting it like this work?
const [{val1, val2, val3}] = arrayOfObjects;