編集の要約なし タグ: visualeditor |
編集の要約なし タグ: visualeditor |
||
| 1行目: | 1行目: | ||
[[ファイル:react-logo.png|thumb|React|300px]] | [[ファイル:react-logo.png|thumb|React|300px]] | ||
とにかく 公式Learn を読む。英語だと分かりやすくて説明が上手。 | |||
* [https://react.dev/learn Quick Start] | * [https://react.dev/learn Quick Start] | ||
2026年6月25日 (木) 13:49時点における版
とにかく 公式Learn を読む。英語だと分かりやすくて説明が上手。
Pick UP
? operator など、Conditional rendering を使う。<syntaxhighlight lang="jsx" line="1">// if statement let content; if (isLoggedIn) {
content = <AdminPanel />;
} else {
content = <LoginForm />;
} return (
{content}
);
// ? operator
{isLoggedIn ? (
<AdminPanel />
) : (
<LoginForm />
)}
</syntaxhighlight>When you don’t need the else branch, you can also use a shorter logical && syntax:<syntaxhighlight lang="jsx" line="1">
{isLoggedIn && <AdminPanel />}
</syntaxhighlight>
Next.js
Next.js を参照。