it’s giving this error
Expected an assignment or function Hotline and instead saw an expression no-unused-expressions
Bạn đang xem: React error
If You’re using JSX inside a function with curly braces you need to lớn modify it to parenthesis.
Wrong Code:
return this.props.todos.map((todo) =>
//Change Curly Brace To Paranthesis change lớn => ()return this.props.todos.map((todo) => (
import React from 'react';class Counter extends React.Component state = count: 0, ; formatCount() const count = this.state; // use a return statement here, it is a importent, return count === 0 ? 'Zero' : count; render() return( this.formatCount() Increment ); export default Counter;
Xem thêm: Làm Chả Giò Để Tủ Lạnh Ngày Tết, Cách Bảo Quản Nem Trong Tủ Lạnh Ngày Tết
Instead ofreturn ( this.formatCount() Increment )Use Below Code
return( this.formatCount() Increment )Basically use brace“(“in the same line of return like“return(“. It will fix this issue
In the above article, we underst& that a very comtháng lambda syntax typo mistakes lead lớn a difficult error, without understanding the phản hồi javascript syntax may lead khổng lồ such types of issues. So, I hope you find them helpful.