简体   繁体   中英

Expected an assignment or function call and instead saw an expression no-unused-expressions when trying to make a component using react

I am getting this error and I am unable to solve this:- Line 6: Expected an assignment or function call and instead saw an expression no-unused-expressions

import React from 'react';
import classes from './BurgerGraphic.module.css';
import BurgerIng from './BurgerIng/BurgerIng';
const BurgerGraphic = (props) => {
    return
    (
        <div className={classes.Burger}>
            <BurgerIng type="bread-top" />
        </div>
    );
};

export default BurgerGraphic;

JavaScript requires the value of the return to be on the same line as the return itself.

This can be worked around by opening parentheses on the same line as the return and then entering the return value within them over multiple lines.

import React from 'react';
import classes from './BurgerGraphic.module.css';
import BurgerIng from './BurgerIng/BurgerIng';
const BurgerGraphic = (props) => {
    return (
        <div className={classes.Burger}>
            <BurgerIng type="bread-top" />
        </div>
    );
};

export default BurgerGraphic;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM