0

the error in the console is : ERROR in [eslint] src\services\orders.js Line 9:3: Expected an assignment or function call and instead saw an expression no-unused-expressions

Search for the keywords to learn more about each error.

app.jsx

import { useEffect, useState } from 'react';
import './App.css';
import { Table } from './components/Table';
import {ordersService} from './services/ordersService'


function App() {
  
  const [orders , setOrders] = useState(null)
  
  useEffect(() => {
    async function fetchData() {
    const ordersData = await ordersService.query();
      console.log(ordersData);
    }
    fetchData();
  }, []);
  

  return (
    <div className="app">
      <Table orders={ orders } />
    </div>
  );
}

services\ordersService.js

export const ordersService = {
  query
}


function query(sortBy) {
  return Promise.resolve(gOrders)
}


const gOrders = [{
    "order_ID": 2790846857303,
    "name": "#38777",
    "total_refunded": 0,
    "created_at": "2020-11-23 23:27:52",
Amit Amar
  • 51
  • 1
  • 8
  • Does this help? https://stackoverflow.com/questions/53013437/expected-assignment-or-function-call-no-unused-expressions-reactjs – luek baja Feb 15 '23 at 14:03
  • You don't show the content of the file mentioned in error message "src\services\orders.js" or named it differently. Make sure you have provided full example containing the line mentioned in the error message "Line 9:3" – Yury Tarabanko Feb 15 '23 at 14:11
  • the content of the file wich the error comes is in ordersService.js – Amit Amar Feb 15 '23 at 14:15
  • Are you sure that you have copied all related code? Try to reproduce the issue here https://t.ly/7ekN – Yury Tarabanko Feb 15 '23 at 14:29
  • I fixed the problem, at first I changed the name of the file and then I changed it back, I had to restart the application, thank you – Amit Amar Feb 15 '23 at 14:37

0 Answers0