警告:无效的属性名称:`'data-*'`

时间:2021-08-01 15:34:43

标签: reactjs typescript svg next.js react-typescript

我正在尝试使用 babel-plugin-inline-react-svg 在 NEXT.js 中导入 svg 文件。

按照所有说明操作,它工作正常

// .babelrc
{
  "presets": ["next/babel"],
  "plugins": [
    ["styled-components", { "ssr": true }],
    "inline-react-svg"
  ]
}
// image.tsx

import styled from 'styled-components';
import BackgroundImage from '../public/assets/img.svg';
export const WhyChooseUsSection = () => {
    return <>
                <div className="background">
                    <BackgroundImage/>
                </div>
                <style jsx>{`
                    div {
                        position: relative;
                        width: 100%;
                    }
                `}</style>
            </>
}
// next.config.js
const withImages = require('next-images')
module.exports = withImages()

但它发生警告

Warning: Invalid attribute name: `'data-name'`

这是因为打字稿吗?我该如何解决?

0 个答案:

没有答案