import React from 'react'
export default function CurlyBraces() {
const title = 'Curly Braces'
return (
<>
{/* 주석 입니다*/}
<h1 style = {{backgroundColor: 'red'}}>{title}</h1>
<p>{10+30}</p>
</>
)
Curly Braces 에서는 객체를 반환 해줄때 객체 자체는 반환이 불가능 하다
- 명확한 결과값을 가진 숫자, 문자열, 논리형을 반환
- person이라는 객체에 name , theme 가 있다면 person을 사용하면 오류 발생
- 해결법: person.name, person.theme 로 호출
구조화 파괴 가능(Destructuring)
- const {name, theme} = person
- person이라는 객체를 파괴하여 name, theme 변수에 초기화