_app.tsxにAppバーコンポーネントを追加する
以下参考プログラムです。
_app.tsx
import React from "react";
import App from "next/app";
import Bar from "../components/Bar";
export default class MyApp extends App {
static async getInitialProps({
Component,
ctx
}: {
Component: any;
ctx: any;
}) {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
return { pageProps };
}
render() {
const { Component, pageProps } = this.props;
return (
<React.Fragment>
<Bar />
<Component {...pageProps} />
</React.Fragment>
);
}
}