Answer the question
In order to leave comments, you need to log in
Why doesn't the new syntax work?
const initState = ['test','more'];
// работает
export default function values(state = initState, action){
if(action.type === 'ADD_VAL'){
return [
...state,
action.date
];
}
return state;
};
// не работает
export default values = (state = initState, action) => {
if(action.type === 'ADD_VAL'){
return [
...state,
action.date
];
}
return state;
};
// тоже работает однако мне не нравится экспорт вниз переносить
// видимо без этого в данном случае никак или ?
const values = (state = initState, action) => {
if(action.type === 'ADD_VAL'){
return [
...state,
action.date
];
}
return state;
};
export default values;
Answer the question
In order to leave comments, you need to log in
export default (state = initState, action) => {
if(action.type === 'ADD_VAL'){
return [
...state,
action.date
];
}
return state;
};
const values = (state = initState, action) => {
if(action.type === 'ADD_VAL'){
return [
...state,
action.date
];
}
return state;
};
export default values;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question