4 ms·
I think the same if you format it properly Obviously I can't read this mess easily ( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: {
by TheCoelacanth 10y ago
I think the same if you format it properly
Obviously I can't read this mess easily
( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: {
requesting: false,
success: false,
error,
} } } )
but this is pretty easy to read
({
...state,
[ siteId ]: {
...state[ siteId ],
[ postId ]: {
requesting: false,
success: false,
error,
}
}
})
Though even easier to read would be to use icepick
import { setIn } from 'icepick';
setIn(state, [siteId, postId], {
requesting: false,
success: false,
error,
});