編集の要約なし
タグ: visualeditor
6行目: 6行目:


==JavaScript==
==JavaScript==
? operator など、Conditional rendering を使う。<syntaxhighlight lang="javascript" line="1">
// if statement
let content;
if (isLoggedIn) {
  content = <AdminPanel />;
} else {
  content = <LoginForm />;
}
return (
  <div>
    {content}
  </div>
);
// ? operator
<div>
  {isLoggedIn ? (
    <AdminPanel />
  ) : (
    <LoginForm />
  )}
</div>
</syntaxhighlight>


==Next.js==
==Next.js==
[[Next.js]] を参照。
[[Next.js]] を参照。

2026年6月24日 (水) 01:08時点における版

ファイル:react-logo.png
React
  • コンポーネント
  • Props
  • State

JavaScript

? operator など、Conditional rendering を使う。<syntaxhighlight lang="javascript" line="1"> // if statement let content; if (isLoggedIn) {

 content = <AdminPanel />;

} else {

 content = <LoginForm />;

} return (

   {content}

);

// ? operator

 {isLoggedIn ? (
   <AdminPanel />
 ) : (
   <LoginForm />
 )}

</syntaxhighlight>

Next.js

Next.js を参照。