import React, { useCallback } from "react"; import { useDispatch, useSelector } from "react-redux"; import { map } from "lodash"; import { applyComicVineMatch } from "../actions/comicinfo.actions"; interface MatchResultProps { matchData: any; comicObjectId: string; } const handleBrokenImage = (e) => { e.target.src = "http://localhost:3050/dist/img/noimage.svg"; }; export const MatchResult = (props: MatchResultProps) => { const dispatch = useDispatch(); const applyCVMatch = useCallback( (match, comicObjectId) => { dispatch(applyComicVineMatch(match, comicObjectId)); }, [dispatch], ); return ( <> {map(props.matchData, (match, idx) => { return ( ); })}
{parseFloat(match.score).toFixed(2)}
{match.name}
{match.volume.name}
Number {match.issue_number}
Type {match.resource_type}
); }; export default MatchResult;