How to avoid this kind of warning?
It gives warning like below.
Unexpected default export of anonymous function import/no-anonymous-default-exp
This is the function which gives warning.
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;
}
}
To avoid this kind of warning, now I am no longer using anonymous functions. So, try this...
export default function foo(state = null, action){
switch(action.type) {
case FETCH_USER:
return action.payload || false ;
default:
return state;
}
}
You are getting the error because in this line of code, you have not provided the function name:
export default function(state = null, action){
The code will still work, however to get rid of the warning provide a function name like so:
export default function functionName(state = null, action){
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With