Skip to content

ERROR => Support for the experimental syntax 'jsx' isn't currently enabled #6

Description

@Santhosh-Umapathi

I received an error and unable to use the react-gaugejs. My project is made with create-react-app and i tried install @babel/plugin-transform-react-jsx, but still it throws the error.

This is my code,

import React, {useEffect} from 'react'

//ReactGauge
import Gauge from 'react-gaugejs';


const ReactGauge = (props) =>
{

   
    const handleResultTextChange = (value) =>
    {
        // this.setState({value: value});
    }

    return (
        <div>
        <Gauge
            value={750}
            minValue={0}
            maxValue={1000}
            animationSpeed={32}
            options={{
                angle: 0.35,
                lineWidth: 0.1,
                radiusScale: 1,
                pointer: {
                    length: 0.6,
                    strokeWidth: 0.035,
                    color: '#000000',
                },
                limitMax: false,
                limitMin: false,
                colorStart: '#6F6EA0',
                colorStop: '#C0C0DB',
                strokeColor: '#EEEEEE',
                generateGradient: true,
                highDpiSupport: true,
            }}
            textChangeHandler={handleResultTextChange}
            donut

            // any other props are passed through to the canvas element
            className='gauge-canvas'
            style={{height: '150px'}}
        />
        </div>
    )
    
};

export default ReactGauge;

Error:

SyntaxError: C:\Users\umapathis\Desktop\Easylink-React\node_modules\react-gaugejs\Gauge.js: Support for the experimental syntax 'jsx' isn't currently enabled (79:5):

  77 | 
  78 |   return (
> 79 |     <>
     |     ^
  80 |       <canvas ref={canvas} {...passThroughProps}></canvas>
  81 |       <span ref={span} style={{display: 'none'}}></span>
  82 |     </>

Add @babel/plugin-transform-react-jsx (https://git.io/vb4yd) to the 'plugins' section of your Babel config to enable transformation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions