
function App() {
return (
<h1> Hello, Second Post! </h1>
);
}
//jsx 형태..?
function App() {
return React.createElemenet("h1", null, "Hello, Second Post!");
}
1. 유형(string, div)
2. props(속성)
3. children (자식 element)
React.createElement(
type,
[props],
[...children]
)
xml/html
{js코드} => 중괄호로 js 코드 사용
xml/html
//예제1
const element = <h1>Hello, World!</h1>;
//jsx사용하지 않은 예제1
const element = React.createElement(
'h1',
{ className: 'greeting},
'Hello, World!
}
//예제2
function App() {
return (
<div>
<div>Hello</div>
<div>HI Haein</div>
</div>
);
}
function App() {
return (
<div>
<div>Hello</div>
<div>{name}</div>
</div>
);
}
이후 conditional Rendering에서 자세하게 포스팅
function App() {
const count = 0;
return (
<div>
{count && <h1>Hello : {count} </h1>
</div>
);
}
//font-size => fontSize
//backgroundColor