concept dynamic value in category nextjs

This is an excerpt from Manning's book Next.js in Action.
The message and friend detail pages take dynamic values from their URLs. We’re not using them yet and we still don’t need them for our first implementation of getInitialProps for those pages. Let’s look at the message details page version of getInitialProps first:
Our approach to supporting style themes allows for dynamic values that can’t be determined at build time, so Next.js will not create a static HTML document for the page. Let’s look at an example that would cause this this to happen.
Listing 5.24: Dynamic themes based on URL query parameters
export default function MyPage({ theme }) { return ( <ThemeContext.Provider value={theme}> ... </ThemeContext.Provider> ); } MyPage.getInitialProps = async function(context) { const theme = (context.query.theme === "demo" ? await import("../themes/demo") : await import("../themes/default-theme") ).default; return { theme }; };By adding the getInitialProps function to the MyPage component, we’re telling Next.js that this page uses dynamic values and cannot be optimized for static content. This is because we’re using a query parameter from the request to determine which theme to use. The getInitialProps function has a context parameter that we can use to access the query parameters that were passed to the page request. In this case, we’re looking for a theme parameter with the value demo. Based on this test, we can dynamically import theme objects (if the theme argument isn’t “demo” or is missing, the default theme is used) and pass them to MyPage as a theme property. Now the theme is truly dynamic and our ThemeProvider context approach continues to work exactly as it has been. For example, if we were to look at listing-10?theme=demo, the page would look like this:
Dynamic values, such as properties passed to the component, are easy to use with styled-jsx styles. With style modules, you’re limited to implementing logic that toggle class names because there’s no way to change style values.