currently, if I have
and I attempt to update the state with devices like so,
const id = '123'
dotProp.set(state, 'devices', list => [...list, id])
I will get an error because list is being defaulted to an object. Instead it would be nice to leave that as undefined for the user to be able to use default params to have better control. So instead it would look like this,
const id = '123'
dotProp.set(state, 'devices', (list = []) => [...list, id])
or if I want my devices to be an object keyed on the ids I could do something like,
const device = {id:'123'}
dotProp.set(state, 'devices', (devices = {}) => {...devices, device})
An alternative approach would be to have a optional parameter at the end to change the default value from {} to []
currently, if I have
and I attempt to update the state with devices like so,
I will get an error because
listis being defaulted to an object. Instead it would be nice to leave that as undefined for the user to be able to use default params to have better control. So instead it would look like this,or if I want my devices to be an object keyed on the ids I could do something like,
An alternative approach would be to have a optional parameter at the end to change the default value from
{}to[]