0
0
NextJSframework~10 mins

Force-dynamic and force-static in NextJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to mark a Next.js page as dynamic.

NextJS
export const dynamic = '[1]';
Drag options to blanks, or click blank then click option'
Aauto
Bforce-dynamic
Cdynamic
Dforce-static
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'force-static' which makes the page static instead of dynamic.
Using 'dynamic' without 'force-' prefix.
2fill in blank
medium

Complete the code to mark a Next.js page as static.

NextJS
export const dynamic = '[1]';
Drag options to blanks, or click blank then click option'
Aforce-static
Bstatic
Cforce-dynamic
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'force-dynamic' which makes the page dynamic instead of static.
Using 'static' without 'force-' prefix.
3fill in blank
hard

Fix the error in the code to correctly force static rendering.

NextJS
export const dynamic = [1];
Drag options to blanks, or click blank then click option'
A'force-static'
B'force-dynamic'
C'static'
Dforce-static
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string value.
Using 'force-dynamic' instead of 'force-static'.
4fill in blank
hard

Fill both blanks to create a Next.js page that is dynamic and uses a server component.

NextJS
export const dynamic = '[1]';

export default function [2]() {
  return <h1>Hello from dynamic page</h1>;
}
Drag options to blanks, or click blank then click option'
Aforce-dynamic
Bforce-static
CPage
DStaticPage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'force-static' instead of 'force-dynamic'.
Naming the component something other than 'Page'.
5fill in blank
hard

Fill all three blanks to create a Next.js page that is static and uses a server component named StaticPage.

NextJS
export const dynamic = '[1]';

export default function [2]() {
  return <main>[3]</main>;
}
Drag options to blanks, or click blank then click option'
Aforce-dynamic
Bforce-static
CStaticPage
D<h1>Welcome to static page</h1>
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'force-dynamic' instead of 'force-static'.
Returning content outside of a valid JSX element.