• + 0 comments

    Here is my simple solution.

    `import React, { useState } from "react";

    const FeedbackSystem = () => { const list = [ { label: "Readability", upVote: 0, downVote: 0 }, { label: "Performance", upVote: 0, downVote: 0 }, { label: "Security", upVote: 0, downVote: 0 }, { label: "Documentation", upVote: 0, downVote: 0 }, { label: "Testing", upVote: 0, downVote: 0 } ]; const [aspectList, setAspectList] = useState(list);

    const handleDownVote = (index) => { aspectList[index].downVote += 1; setAspectList([...aspectList]) }

    const handleUpVote = (index) => { aspectList[index].upVote += 1; setAspectList([...aspectList]) }

    return ( {aspectList.map((aspect, index) => (

    {aspect.label}

    upvote-btn-Extra close brace or missing open brace{index}} onClick={() => handleDownVote(index)}> 👎 Downvote upvote-count-${index}}> Upvotes: {aspect.upVote}

    downvote-count-${index}}> Downvotes: {aspect.downVote}

    ))} ); };

    export default FeedbackSystem;

    `