Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn on the 'throwIfNamespace' flag in React.js

I have some code like below in my component.

<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%;">

I am getting error like below

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.

How can I turn on the 'throwIfNamespace' flag ?

enter image description here

like image 609
abu abu Avatar asked Dec 02 '19 12:12

abu abu


People also ask

How do I enable JSX in react?

To use JavaScript inside of JSX, you need to surround it with curly braces: {} . This is the same as when you added functions to attributes. To create React components, you'll need to convert the data to JSX elements. To do this, you'll map over the data and return a JSX element.


1 Answers

Use camel case notation. Try this code instead. You are getting the error because of this xmlns:xlink syntax react does not know how to compile this.

<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%;">
like image 93
Abdug'affor Abdurahimov Avatar answered Sep 23 '22 06:09

Abdug'affor Abdurahimov