You are viewing a single comment's thread. Return to all comments →
import React, { useState } from "react";
const FeedbackSystem = () => {
const [list, setList] = useState([{ label:"Readablity", up:0, down:0 }, { label:"Performance", up:0, down:0 }, { label:"Security", up:0, down:0 }, { label:"Documentation", up:0, down:0 }, { label:"Testing", up:0, down:0 } ]);
const handleUpvote = (index) => { const data = [...list] data[index].up+=1 setList(data) };
const handleDownvote = (index) => { const data = [...list] data[index].down+=1 setList(data) };
return ( {list.map((lists,index) => (
export default FeedbackSystem;
why the test cases are failing
Seems like cookies are disabled on this browser, please enable them to open this website
Code Review Feedback
You are viewing a single comment's thread. Return to all comments →
import React, { useState } from "react";
const FeedbackSystem = () => {
const [list, setList] = useState([{ label:"Readablity", up:0, down:0 }, { label:"Performance", up:0, down:0 }, { label:"Security", up:0, down:0 }, { label:"Documentation", up:0, down:0 }, { label:"Testing", up:0, down:0 } ]);
const handleUpvote = (index) => { const data = [...list] data[index].up+=1 setList(data) };
const handleDownvote = (index) => { const data = [...list] data[index].down+=1 setList(data) };
return ( {list.map((lists,index) => (
{lists.label}
upvote-btn-{lists.down}} onClick={() => handleDownvote(index)} > 👎 Downvote upvote-count-${lists.up}}> Upvotes: {lists.up} downvote-count-${lists.down}}> Downvotes: {lists.down} ))} ); };export default FeedbackSystem;
why the test cases are failing