同じ表示、書くものが違う
左は「どうやって画面を組み立てるか」の手順、右は「どうなっていてほしいか」を書いています。
命令的:手順を書く
const box = document.getElementById("profile");
const title = document.createElement("h1");
title.textContent = "あおいのプロフィール";
box.appendChild(title);宣言的 UI:完成形を書く
export default function App() {
return <h1>あおいのプロフィール</h1>;
}DOM をどの順番で組み立てるかは React がやります。
1 / 4