gpt4 book ai didi

reactjs - 如何在 React.js 中打开 'throwIfNamespace' 标志

转载 作者:行者123 更新时间:2023-12-03 13:32:02 26 4
gpt4 key购买 nike

我的组件中有一些如下代码。

<svg id="SvgjsSvg3254" width="318" height="152" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" class="apexcharts-svg" xmlns:data="ApexChartsNS" transform="translate(0, 0)" style="background: transparent none repeat scroll 0% 0%;">

我收到如下错误

Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the 'throwIfNamespace' flag to bypass this warning.

如何打开 throwIfNamespace 标志?

enter image description here

最佳答案

由于 xmlns:xlink 语法,您收到错误,React 不知道如何编译它。使用驼峰式大小写表示法,即 xmlnsXlink

试试这个:

<svg id="SvgjsSvg3254" width="318" height="152" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlnsXlink="http://www.w3.org/1999/xlink" xmlnsSvgjs="http://svgjs.dev/svgjs" class="apexcharts-svg" xmlnsData="ApexChartsNS" transform="translate(0, 0)" style="background: transparent none repeat scroll 0% 0%;">

关于reactjs - 如何在 React.js 中打开 'throwIfNamespace' 标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59138677/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com