I tried to follow these steps:
(Next.js) How can I change the color of SVG in next/image?
I'm using next.js too, but I'm unable to change the svg color
My next.config.js:
const webpack = require('webpack');
// next.config.js
module.exports = {
images: {
domains: ['raw.githubusercontent.com'],
},
entry: './components/Modal.js',
module: {
rules: [
//...
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
],
},
}
but the svg doesn't show up and I get these errors in the console:
next-dev.js?3515:32 Warning: is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements. at watchProject
next-dev.js?3515:32 Warning: The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
My code:
import watchProject from "../public/icons/watch_project.svg";
[...]
<watchProject fill="blue"></watchProject>
If I use Image component the svg appear, but I can't change the properties
import watchProject from "../public/icons/watch_project.svg";
[...]
<Image src={watchProject} stroke="green" alt="star" width={18} height={18} />