You are viewing a single comment's thread. Return to all comments →
whats going on i dont understand why its failing
const FeedbackSystem = () => { const [aspects, setAspects] = useState([ { title: "Readability", upvotes: 0, downvotes: 0 }, { title: "Performance", upvotes: 0, downvotes: 0 }, { title: "Security", upvotes: 0, downvotes: 0 }, { title: "Documentation", upvotes: 0, downvotes: 0 }, { title: "Testing", upvotes: 0, downvotes: 0 } ]); function hndlupvote(index) { const copyaspects = [...aspects]; copyaspects[index].upvotes +=1; setAspects(copyaspects) } function hndldownvote(index) { const copyaspects = [...aspects]; copyaspects[index].downvotes +=1; setAspects(copyaspects) }
return ( {aspects.map((item,index) => (
export default FeedbackSystem;
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 →
whats going on i dont understand why its failing
const FeedbackSystem = () => { const [aspects, setAspects] = useState([ { title: "Readability", upvotes: 0, downvotes: 0 }, { title: "Performance", upvotes: 0, downvotes: 0 }, { title: "Security", upvotes: 0, downvotes: 0 }, { title: "Documentation", upvotes: 0, downvotes: 0 }, { title: "Testing", upvotes: 0, downvotes: 0 } ]); function hndlupvote(index) { const copyaspects = [...aspects]; copyaspects[index].upvotes +=1; setAspects(copyaspects) } function hndldownvote(index) { const copyaspects = [...aspects]; copyaspects[index].downvotes +=1; setAspects(copyaspects) }
return ( {aspects.map((item,index) => (
{item.title}
hndlupvote(index)}> 👍 Upvote hndldownvote(index)}> 👎 Downvote Upvotes: {item.upvotes} Downvotes: {item.downvotes} ))} ); };export default FeedbackSystem;