匿名函数import/no-anonymous-default-export的意外默认导出
如何避免这种警告?
它发出如下警告。
Unexpected default export of anonymous function import/no-anonymous-default-exp
这是发出警告的功能。
import { FETCH_USER } from '../actions/types';
export default function(state = null, action){
switch(action.type) {
case FETCH_USER:
return action.payload || false ;
default:
return state;
}
}
回答
为了避免这种警告,现在我不再使用匿名函数。所以,试试这个...
export default function foo(state = null, action){
switch(action.type) {
case FETCH_USER:
return action.payload || false ;
default:
return state;
}
}
- Can you elaborate what happened here? It worked, but I still didn't get exactly how it worked.
THE END
二维码