React.createElement(
type,
[props],
[...children]
)
"h1"
"p"
"div"
...// props 사용
const elementA = React.createElement("h1", {
children: "Hello World!"
})
// children 사용
const elementB = React.createElement("h1", null, "Hello World!")
//props 사용
const elementA = React.createElement("h1", {
children: ["Hello World!", "I'm Shelly"]
})
// children 사용
const elementB = React.createElement("h1", null, ["Hello World!", "I'm Shelly"] )
const element = document.createElement("h1")
element.textContents("Hello World!")
const element = React.createElement("h1", {
children: "Hello World!"
})
매번 React.createElement("h1", 어쩌구 저쩌구)를 작성하는게 귀찮다🥲 그런데 JSX라는 문법을 사용하면, 비교적 빠르게 element를 생성하는 코드를 작성할 수 있다.
const element = React.createElement("h1", {
children: "Hello World!"
})
const element = <h1>Hello World!</h1>;