. Advertisement .
..3..
. Advertisement .
..4..
When I run my program, i encounter this error message:
Expected an assignment or function call and instead saw an expression no-unused-expressions
Here is my code:
const todoList = ({ todos, onTodoclick }) => {
return (<ul>
{
todos.map(todo => {
<Todo key={todo.id}
{...todo}
onClick={() => onTodoclick(todo.id)}>
</Todo>
})
}
</ul>)
}
How can I do with ”expected an assignment or function call and instead saw an expression no-unused-expressions” error?
The cause: This error happens because you put a bracket on the return statement.
Solution: You should put opened bracket ( on the same line
after => lamda expression
, and removed the return statement as the following:Follow the article below to understand more
👇️ Resolve error: “Expected an assignment or function call and instead saw an expression”