this is my code can un help with it how to write slice function properly
export default function(state={inputs:[ ]}, action) {
console.log(action.index);
switch (action.type) {
case APPEND_INPUT:
return { ...state, inputs: state.inputs.concat({value:"",key:"1",type:'input'})};
case APPEND_TEXTAREA:
return { ...state, inputs: state.inputs.concat({value:"",key:"",type:'textarea'})};
case APPEND_EMAIL:
return { ...state, inputs: state.inputs.concat({value:"",key:"",type:'email'})};
case REMOVE_INPUT:
return {inputs: state.inputs.slice(0)};
default:
return state;
}
}