Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hagevvashi/ffb0d5f3eb129a6b56392e12b95451bf to your computer and use it in GitHub Desktop.
Save hagevvashi/ffb0d5f3eb129a6b56392e12b95451bf to your computer and use it in GitHub Desktop.
index.htmlのroute側の追加
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