We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Code Review Feedback
Code Review Feedback
Sort by
recency
|
81 Discussions
|
Please Login in order to post a comment
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;
What's wrong with my code-
I have working code for this problem i am able to check required functionality, but its giving 0 score via run tests
my test cases are failing! although the solution works fine
I dont see clean up in the test file that ensures that after every test, React Testing Library completely unmounts the component and resets all internal hook states — so each test starts fresh.
`Any suggestions?