Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

React.forwardRef() – Parsing error: Missing semicolon

I found an error after adding React.forwardRef() to my .JSX component file.

import React from 'react';
import classes from './MyInput.module.css';

const MyInput = React.forwardRef((props, ref)) => {

    return (
       <input className={classes.myInput} {...props} />
    );
};

export default MyInput;

Now I have this error:

ERROR in [eslint]

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

src\components\UI\inputs\MyInput.jsx

Line 4:46: Parsing error: Missing semicolon. (4:46)

>Solution :

You are closing the parenthesis opened after React.forwardRef at the wrong place:

import React from 'react';
import classes from './MyInput.module.css';

const MyInput = React.forwardRef((props, ref) => {

    return (
       <input className={classes.myInput} {...props} />
    );
});

export default MyInput;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading