Complete the code to export a Next.js page as a static HTML file.
export default function Home() {
return <h1>Hello, Next.js!</h1>;
}
export async function [1]() {
return { props: {} };
}The getStaticProps function tells Next.js to generate the page at build time, enabling static export.
Complete the code to enable static export by adding the correct config option.
const nextConfig = {
[1]
};
export default nextConfig;Setting output: 'export' in next.config.js enables static HTML export.
Fix the error in the static export config by choosing the correct option.
module.exports = {
output: [1]
};The correct value for static export is 'export'. Other values do not enable static HTML export.
Fill both blanks to create a static page with dynamic paths.
export async function [1]() { return { paths: [{ params: { id: '1' } }], [2]: false }; }
getStaticPaths defines dynamic routes for static export, and fallback controls behavior for missing paths.
Fill all three blanks to export a static page with props and fallback.
export async function [1]() { return { props: { message: 'Hello' } }; } export async function [2]() { return { paths: [], [3]: true }; }
getStaticProps provides props for the page, getStaticPaths defines dynamic routes, and fallback enables fallback rendering.