Answer the question
In order to leave comments, you need to log in
How to remake a function in jsx so that there is no error?
A linter error appears
Expected an assignment or function call and instead saw an expression no-unused-expressions
const handleTumblerClick = (isChecked) => {
if (isRequestDone || isRequestInSavedDone) {
isOnSavedPage ? filterShortFilmsInSaved(isChecked) : filterShortFilms(isChecked);
}
};
Answer the question
In order to leave comments, you need to log in
You misunderstand.
It jsx
has nothing to do with it at all.
The rule enabled by default eslint does not like when the train operator is "hanging in the air" (not assigned to a variable or not passed to a function, for example). Rewrite to if else
, somehow use the result (for example return isOnSa...
), or turn off\ignore the rule - there is no real problem here, it's just that such constructions can often be a mistake (when you just forgot to use the result).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question