I want to access a specific indexed object from object of array of REDUX STORE in REDUX REDUCER. But what would be the best and simplest way to do it.
This is the object (array of object)
const formData = [
{
name : 'Aman jat',
gender : 'male'
},
{
name : 'Ravina',
gender : 'female'
}
]
This is what i want to do ::
const reducer = (state=formData,action) => {
if(action.type=='INSERT_INFO') {
return {
...state,
state[0].name : action.payload_name1 <<<< this is my problem
}
}
else
return state
}