Is initialState in a mixin merged with initialState in a component?

javascript, reactjs

Solution

Yes, it's possible to merge the state from component A and the state declared in mixin M used by A if the states don't share keys. If they share keys, the Error "Invariant Violation: mergeObjectsWithNoDuplicateKeys()" will be thrown.

PS: using React.js 0.9.0.

Problem

Simple question : if component A declares `getInitialState` and uses mixin M that also declares `getInitialState`, will both be merged in the "final" component A ? Use case : I have several forms which share fields and associated state, and I want to avoid code duplication between them, so that each component declares only what's specific to it. I already used mixins in the recent past, but never with state.

Original source