expense-tracker-react icon indicating copy to clipboard operation
expense-tracker-react copied to clipboard

Warning : Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export

Open bikkimahato opened this issue 3 years ago • 1 comments

src\context\AppReducer.js Line 1:1: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export

bikkimahato avatar Jul 16 '21 18:07 bikkimahato

It's telling you to give the object being exported a name before exporting, to make it more likely that the name used is consistent throughout the codebase. For example, change to:

const reducer = (state, action) => { switch(action.type) { case 'DELETE_TRANSACTION': return{ ...state, transactions: state.transactions.filter(transaction => transaction.id !== action.payload) } case 'ADD_TRANSACTION': return{ ...state, transactions: [action.payload, ...state.transactions] } default: return state; } } export default reducer

niraj23 avatar Aug 03 '21 20:08 niraj23