How to combine and use multiple Next.js plugins

You can use next-compose-plugins and combine multiple next.js plugins as follows: // next.config.js const withPlugins = require(‘next-compose-plugins’); const withSass = require(‘@zeit/next-sass’); const withCSS = require(‘@zeit/next-css’); module.exports = withPlugins( [ [withSass, { /* plugin config here … */ }], [withCSS, { /* plugin config here … */ }], ], { /* global config here … */ … Read more

React + Material-UI – Warning: Prop className did not match

The problem is the SSR rendering in Next.js, which produces the style fragment before the page is rendered. Using Material UI and Next.js (as the author is using), adding a file called _document.js solved the problem. Adjusted _document.js (as suggested here): import React from ‘react’; import Document, { Html, Head, Main, NextScript } from ‘next/document’; … Read more

Text Stroke (-webkit-text-stroke) css Problem

TL;DR: -webkit-text-stroke is still quite unpredictable the text-shadow as proposed by @Satheesh Kumar is probably the most reliable solution. @Luke Taylor’s approach – duplicating text to a background pseudo element – also provides a good workaround. Anatomy of a variable font As @diopside: pointed out this rendering behaviour is related to variable fonts. The reason … Read more

Next.js router is returning query parameters as undefined on first render?

Just found out what is the solution to my problem: From: https://nextjs.org/docs/api-reference/next/router#router-object isReady: boolean – Whether the router fields are updated client-side and ready for use. Should only be used inside of useEffect methods and not for conditionally rendering on the server. This is what happens to the router.query on client when you hit /search?q=XXX. … Read more