我遵循指導在我的react-native
應用程序中實施REDUX。我想實現行動但我eslint
不斷給予8日這個錯誤線 -導出ES6中聲明爲常量的函數
[eslint] Prefer default export. (import/prefer-default-export)
我的代碼 -
import * as types from './types';
const incrementCounter = counterValue => ({
type: types.INCREMENT_COUNTER,
counterValue,
});
export { incrementCounter };
我的問題是什麼是導出這個常量的正確方法在ES6中的功能?
你的語法很好。 ESLint會觸發,因爲根據您的規則,如果您的模塊*只有一個導出*,那麼它應該是*默認*。根據這條規則,如果你有多個,你應該只'輸出{...}。堅持你的規則:'出口默認incrementCounter' – CodingIntrigue
謝謝,它的工作。 :) –