//数据库是硬编码的,看起来像这样:
常数分贝=[
{name: "pantaloni",
id:'1',
imgUrl: "https://static.zara.net/photos///2021/V/0/1/p/1930/026/800/2/w/1280/1930026800_6_1_1.jpg?ts=1608226801975"},
{name: "geaca",
id:'2',
imgUrl: "https://i.pinimg.com/736x/38/b3/54/38b354027a74d5d39bec89a5c8b1eb48.jpg"},
{name: "bluza albastra",
id:'3',
imgUrl: "https://resense.ro/wp-content/uploads/2020/02/bluza-dama-voal-verde-maneca-ampla-giulia-scaled.jpg"},
{name: "bluza",
id:'4',
imgUrl: "https://static.zara.net/photos///2021/V/0/1/p/8741/271/712/2/w/1280/8741271712_6_1_1.jpg?ts=1609850127999"}
];
//那么函数就是:
function TinderCards(name, imgUrl,id) {
const [{Favorite}, dispatch] = useStateValue()
console.log('this is' ,Favorite)
const addToFavorite = () =>{
dispatch({
type:"ADD_TO_FAVORITE",
item:{
imgUrl:imgUrl,
name:name,
id:id
}
})
};
//链接到like按钮:
function clickEvent(){
swipe('right');
addToFavorite()
}
//当我点击一切都是空对象时->图像: 控制台输出是空对象