flux
flux copied to clipboard
Return a "snapshot" of the store object instead of returning a reference to the object directly
Please consider updating the docs and examples from this pattern:
var user = {
name: ''
};
export default new class Store extends EventEmitter {
...
get value() {
return user;
}
...
}();
to this pattern:
get value() {
return Object.assign({}, user);
}
More information here.
Use immutable data if you are working with shouldComponentUpdate. I'd recommend ImmutableJS for that.
We are keeping these examples very simple so they are easy to understand -- the minimum code required to explain the pattern. Use of shouldComponentUpdate fall outside of that.