код хока:
export function withLayout<CTX extends NextPageContext | AppContext, IP, P>(
TargetComponent: NextComponentType<CTX, IP, P>
) {
return class WithAuthGuard extends Component<P> {
static displayName = withLayout(${TargetComponent.displayName || TargetComponent.name})
;
constructor(props: P) {
super(props);
}
render() {
return (
<MainLayout>
<TargetComponent {...(this.props as any)} />
</MainLayout>
);
}
};
}