
※ 공식문서를 읽고 정리한 글입니다.
function formatName(user) {
  return user.firstName + ' ' + user.lastName;
}
const user = {
  firstName: 'Harper',
  lastName: 'Perez'
};
const element = (
  <h1>
    Hello, {formatName(user)}!
  </h1>
);
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<h1>{element}</h1>); // "Hello, Harper Perez!
const element = <a href="https://www.reactjs.org"> link </a>;  // 문자열
const element = <img src={user.avatarUrl}></img>; // 표현식
const element = (
  <div>
    <h1>Hello!</h1>
    <h2>Good to see you here.</h2>
  </div>
);
const element = <img src={user.avatarUrl} />;
const title = response.potentiallyMaliciousInput; //보안상 문제가 될 수 있음
const element = <h1>{title}</h1>;
const element = (
  <h1 className="greeting">
    Hello, world!
  </h1>
);
//equal to
const element = React.createElement(
  'h1',
  {className: 'greeting'},
  'Hello, world!'
);
//that create (not accurate expression)
const element = {
  type: 'h1',
  props: {
    className: 'greeting',
    children: 'Hello, world!'
  }
};
function getGreeting(user) {
  if (user) {
    return <h1>Hello, {formatName(user)}!</h1>;
  }
  return <h1>Hello, Stranger.</h1>;
}