3 ms·
To me first version carry less cognitive load. But maybe I've been using new JS features for too long.
by elcct 10y ago
To me first version carry less cognitive load. But maybe I've been using new JS features for too long.
- TheCoelacanth 10y agoI 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, });