강의

멘토링

로드맵

Inflearn Community Q&A

hyeonsu's profile image
hyeonsu

asked

Learning React while making web games

4-2. Check the response speed by inserting setTimeout

render 안에 함수 질문

Written on

·

274

1

onClickscreen 함수는 왜 () 를 안붙이고,

renderAverage함수는 왜 ()를 붙여야 오류가 안날까요?

다르게하면 오류가 나요 ㅜㅜㅜ 차이를 모르겠어요 !

똑같은 function들인데 무슨차이인가요?

react

Quiz

44% of people got it wrong. Give it a try!

React JSX에서 특정 조건을 만족할 때만 요소를 렌더링하려면 어떻게 해야 할까요?

`if (condition) { return <Element />; }` 와 같이 if 문을 직접 사용한다.

`condition && <Element />` 또는 `condition ? <Element /> : null` 과 같은 표현식을 사용한다.

`<Element if={condition} />` 와 같이 if 속성을 사용한다.

별도의 HTML 파일에 조건을 분리하여 작성한다.

Answer 2

1

zerocho님의 프로필 이미지
zerocho
Instructor

위는 이벤트 함수라서 이벤트 발생 시 알아서 실행되고 아래는 컴포넌트 분리 함수라서 리턴값으로 컴포넌트를 넣어줘야합니다.

0

junghyeonsu님의 프로필 이미지
junghyeonsu
Questioner

아하 감사합니다!

hyeonsu's profile image
hyeonsu

asked

Ask a question