Why should I keep the state flat
问题 I'm using ReactJs with Redux and on some tutorials and codes I see people suggesting and using normalizr to keep the state flat . But what is the real advantage in keeping it flat ? Will I encounter any problems if I don't ? Is it necessary ? 回答1: Three main reasons: Updating nested Javascript objects immutably generally results in uglier code that is harder to maintain, unless you use a utility library to wrap up the process Immutably updating nested data requires that you return new copies