【发布时间】:2020-04-05 03:37:31
【问题描述】:
目前正在获取 期望一个赋值或函数调用,而是看到一个表达式 no-unused-expressions
我尝试在三元运算符末尾返回一个空 div,但仍然得到相同的错误。
React.useEffect(() => {
if (response && !isLoading) {
showNotification({
variant: "success",
message: `Your invitation ${
name.props ? name.props.children : name
}-${data} was successfully sent.`
});
closeAlert();
viewName === "GetAllData"
? dispatch({
type: "FETCH_DATA",
payload: { loading: true }
})
: dispatch({
type: "FETCH_AVAILABLE_STAFF",
payload: { loading: true }
});
}
return <div />;
}, [response, isLoading]);
【问题讨论】:
-
为什么要返回一个 div?无论如何它都不会被渲染
标签: javascript reactjs eslint conditional-operator