Created
November 24, 2020 16:57
-
-
Save hagevvashi/ffb0d5f3eb129a6b56392e12b95451bf to your computer and use it in GitHub Desktop.
index.htmlのroute側の追加
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC, ReactElement } from "react"; | |
const HelloPage: FC = () => ( | |
<> | |
<section> | |
<h2>ページ一覧</h2> | |
<section> | |
<h3>大事なページ</h3> | |
<ul> | |
<li> | |
<a href="/page1.html">ページ1</a> | |
</li> | |
<li> | |
<a href="/page2.html">ページ2</a> | |
</li> | |
</ul> | |
</section> | |
<section> | |
<h3>その他</h3> | |
<ul> | |
<li> | |
<a href="/coverage/lcov-report/index.html">カバレッジ</a> | |
</li> | |
</ul> | |
</section> | |
</section> | |
</> | |
); | |
function route(action: string): ReactElement { | |
switch (action) { | |
case "index": { | |
return <HelloPage />; | |
} | |
case "page1": { | |
return <Page1 />; | |
} | |
case "page2": { | |
return <Page2 />; | |
} | |
default: { | |
throw new Error("ありえない chunks が設定されているのでエラー"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment