How to use Material Icons with next.js?

0
import Link from 'next/link';
import MaterialIcon from 'material-icons-react';

const Header = (props) => {
  return (
    <nav>
      <ul>
        {navOptions.map(nav => (
          <li>
            <Link href={nav.url}>
              <a>
                <MaterialIcon icon={nav.icon} />
                <span key={nav.icon}>{nav.name}</span>
              </a>
            </Link>
          </li>
        ))}
      </ul>
    </nav>
  )
}

export default Header;

The above code generates the following error:

I think I need a loader, but I can not figure out which one.

    
asked by anonymous 21.11.2018 / 06:57

1 answer

0

You will need the loader @ zeit / next-css

npm install --save @zeit/next-css

Create a next.config.js file (without CSS Modules)

// next.config.js
const withCSS = require('@zeit/next-css')
module.exports = withCSS()

More information:

link

    
22.11.2018 / 02:43