본문 바로가기
카테고리 없음

JSX

by ormgm 2020. 3. 20.

https://reactjs.org/docs/introducing-jsx.html

 

Introducing JSX – React

A JavaScript library for building user interfaces

reactjs.org

 

  • JSX Prevents Injection Attacks

  • Specifying Children with JSX

  • Specifying Attributes with JSX ( use camelCase)

  • Babel compiles JSX down to React.createElement() calls.

셋다 같은 문장  'React elements'

  • const element = ( <h1 className="greeting"> Hello, world! </h1> );

  • const element = React.createElement( 'h1', {className: 'greeting'}, 'Hello, world!' );

  • const element = { type: 'h1', props: { className: 'greeting', children: 'Hello, world!' } }; 

 

  • 컴포넌트 이름은 항상 대문자로 시작

 

 

댓글