Sort by

recency

|

75 Discussions

|

  • + 0 comments

    Before you begin any of these coding tests, you must read the test file to see how they test it. They are not testing functionality sometimes, your failing test might just be an improper test-id that has to be dynamically set.

  • + 0 comments

    so many visible bugs in the hackerrank platform i dont even have to point out any

  • + 0 comments

    My new component:

    import React, {useState} from "react";
    
    
    const ReviewFeedback = ( {name, id} ) => {
    
    
      const [upVotes, setUpVotes] = useState(0);
      const [downVotes, setDownVotes] = useState(0);
      
      const upVoteBtnClick = () => {
    
        setUpVotes(upVotes + 1);
    
      };
    
    
      const downVoteBtnClick = () => {
    
        setDownVotes(downVotes + 1);
    
      };
    
    
      return (
        <div className="my-0 mx-auto text-center w-mx-1200 card-custom">
          <div className="flex wrap justify-content-center mt-30 gap-30">
            <div className="pa-10 w-300 card">
              <h2>{name}</h2>
              <div className="flex my-30 mx-0 justify-content-around">
                <button className="py-10 px-15" data-testid={"upvote-btn-" + id} onClick={upVoteBtnClick}>
                  👍 Upvote
                </button>
                <button className="py-10 px-15 danger" data-testid={"downvote-btn-" + id} onClick={downVoteBtnClick}>
                  👎 Downvote
                </button>
              </div>
              <p className="my-10 mx-0" data-testid={"upvote-count-" + id}>
                Upvotes: <strong>{upVotes}</strong>
              </p>
              <p className="my-10 mx-0" data-testid={"downvote-count-" + id}>
                Downvotes: <strong>{downVotes}</strong>
              </p>
            </div>
          </div>
        </div>
      );
    
    
    };
    
    
    
    export default ReviewFeedback;
    
  • + 0 comments

    This is my FeedBack Component

    const FeedbackSystem = () => { // const [Upvote, setUpvote] = React.useState(0) // const [Downvote, setDownvote] = React.useState(0) const [cards, setCards] = React.useState( [ { id: 0, name: "Readability", Upvote: 0, Downvote: 0 }, { id: 1, name: "Performance", Upvote: 0, Downvote: 0 }, { id: 2, name: "Security", Upvote: 0, Downvote: 0 }, { id: 3, name: "Documentation", Upvote: 0, Downvote: 0 }, { id: 4, name: "Testing", Upvote: 0, Downvote: 0 }, ])

    function upVote(id) { //setUpvote(prev => prev + 1)

    setCards(prev =>
      prev.map((card, index) => (
        index == id ?
          { ...card, Upvote: card.Upvote + 1 } : card
      )))
    

    }

    function downVote(id) { //setDownvote(prev => prev + 1) setCards(prev => prev.map((card, index) => ( index == id ? { ...card, Downvote: card.Downvote + 1 } : card ))) }

    return ( { cards.map((card, index) => (

    {card.name}

    upVote(index)} downVote={() => downVote(index)} id={index} />

                {/* <button className="py-10 px-15" data-testid={`upvote-btn-${index}`} onClick={() => upVote(index)}>
                  👍 Upvote
                </button>
                <button className="py-10 px-15 danger" data-testid={`downvote-btn-${index}`} onClick={() => downVote(index)}>
                  👎 Downvote
                </button> */}
              </div>
              <p className="my-10 mx-0" data-testid={`upvote-count-${index}`}>
                Upvotes: <strong>{card.Upvote}</strong>
              </p>
              <p className="my-10 mx-0" data-testid={`downvote-count-${index}`}>
                Downvotes: <strong>{card.Downvote} </strong>
              </p>
            </div>
          )
          )
        }
      </div>
    </div>
    

    ); };

    export default FeedbackSystem;

    This is my Button Component

    export default function Button({upVote,downVote,id}) {

    return ( <> upvote-btn-Extra close brace or missing open brace{id}} onClick={downVote}> 👎 Downvote ) } Where I made misatke , my test cases are failing

    WWhere

  • + 0 comments

    import React, {useState} from "react";

    const aspects = ["Readability", "Performance", "Security", "Documentation", "Testing"];

    const FeedbackSystem = () => { const [feedback, setFeedback] = useState( aspects.map(() => ({ upvotes: 0, downvotes: 0 })) );

    const handleUpvote = (index) => { const newFeedback = [...feedback]; newFeedback[index].upvotes ++; setFeedback(newFeedback); };

    const handleDownvote = (index) => { const newFeedback = [...feedback]; newFeedback[index].downvotes ++; setFeedback(newFeedback); }; return ( {aspects.map((aspect, index) => (

    {aspect}

    upvote-btn-Extra close brace or missing open brace{index}} onClick={() => handleDownvote(index)}> 👎 Downvote upvote-btn-${index}}> Upvotes: {feedback[index].upvotes}

    downvote-count-${index}}> Downvotes: {feedback[index].downvotes}

    ))} ); };

    export default FeedbackSystem;