anhtutrn / ReactNative

0 stars 0 forks source link

Em vào xem qua nhé :D #2

Open quocdatt8 opened 3 years ago

quocdatt8 commented 3 years ago

- Điểm tốt: Bài hoàn thành đầy đủ các yêu cầu của Assignment, có chia các components riêng

Một vài lưu ý:

  1. Sau e push lên git nên kèm theo một file media (.gif, .mp4) để demo sẽ okay hơn nè
  2. Phần style nên tách ra làm 1 file riêng để quản lý
  3. Các function nên chuyển sang xài useCallback(), ví dụ:

    const onPress = playerChoice => {
    const [result, compChoice] = getRoundOutcome(playerChoice);
    
    const newUserChoice = CHOICES.find(choice => choice.name === playerChoice);
    const newComputerChoice = CHOICES.find(
      choice => choice.name === compChoice,
    );
    
    setGamePrompt(result);
    setUserChoice(newUserChoice);
    setComputerChoice(newComputerChoice);
    };

    sẽ được chuyển thành

    const onPress = useCallback(playerChoice => {
    const [result, compChoice] = getRoundOutcome(playerChoice);
    
    const newUserChoice = CHOICES.find(choice => choice.name === playerChoice);
    const newComputerChoice = CHOICES.find(
      choice => choice.name === compChoice,
    );
    
    setGamePrompt(result);
    setUserChoice(newUserChoice);
    setComputerChoice(newComputerChoice);
    }, []);
anhtutrn commented 3 years ago

Vâng, em cảm ơn ạ. Em sẽ rút kinh nghiệm lần sau.

Vào Th 3, 21 thg 7, 2020 vào lúc 15:04 quocdatle2508 < notifications@github.com> đã viết:

- Điểm tốt: Bài hoàn thành đầy đủ các yêu cầu của Assignment, có chia các components riêng

Một vài lưu ý:

  1. Sau e push lên git nên kèm theo một file media (.gif, .mp4) để demo sẽ okay hơn nè
  2. Phần style nên tách ra làm 1 file riêng để quản lý
  3. Các function nên chuyển sang xài useCallback(), ví dụ:

const onPress = playerChoice => {

const [result, compChoice] = getRoundOutcome(playerChoice);

const newUserChoice = CHOICES.find(choice => choice.name === playerChoice);

const newComputerChoice = CHOICES.find(

  choice => choice.name === compChoice,

);

setGamePrompt(result);

setUserChoice(newUserChoice);

setComputerChoice(newComputerChoice);

};

sẽ được chuyển thành const onPress = useCallback(playerChoice => { const [result, compChoice] = getRoundOutcome(playerChoice);

const newUserChoice = CHOICES.find(choice => choice.name === playerChoice);

const newComputerChoice = CHOICES.find(

choice => choice.name === compChoice,

);

setGamePrompt(result);

setUserChoice(newUserChoice);

setComputerChoice(newComputerChoice);

}, []);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/anhtutran123/ReactNative/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLGO23XLJTHFBA72CU5D2DR4VD2JANCNFSM4PDJEUGA .