import React, { useState } from "react"; import { fetcher } from "../../pages/api/fetch"; import { IProduct } from "../../store/reducers/nodesInputReducer"; import styles from "./card.module.css" export const ProductCard: React.FC = (props) =>{ const [opened, setOpened] = useState(false) const onClick = () =>{ setOpened(true) fetcher.post("/score/" + props.id) } return( props.characteristic == undefined? null:
{props.name}
{props.score} прсмотров
{props.characteristic.length} характеристик
ID:{props.id}
onClick()} className={styles.aboutBtn}>Подробнее
{opened?
setOpened(false)}>+
{props.name}
{props.score} прсмотров
ID:{props.id}
{props.characteristic.length} характеристик
{ props.characteristic.map(el=>
{el.name}:
{el.value}
) }
: null }
); }