Redux: Mixing local state and global state
up vote
0
down vote
favorite
I'm using redux with angularJS, but I guess it doesn't matter.
I have a component which filters data. It is looks like this:
filter: string = '';
mapStateToProps (state) {
const filteredRecords = Selector_Records.getFilteredData(this.filter)
return {
};
}
...
ngOnInit () {
this.$ngRedux.connect(this.mapStateToProps.bind(this), null);
}
filterOnChange (text: string) {
this.filter = text;
}
I just don't want to store filter in a global state. So my question is - Is it ok to manually mutate this.props
with manually called mapStateToProps
?
Like this:
filterOnChange (text: string) {
this.filter = text;
this.props = Object.assign(this.props, this.mapStateToProps(this.$ngRedux.getState()));
}
Or is it better solution do exists?
redux state
add a comment |
up vote
0
down vote
favorite
I'm using redux with angularJS, but I guess it doesn't matter.
I have a component which filters data. It is looks like this:
filter: string = '';
mapStateToProps (state) {
const filteredRecords = Selector_Records.getFilteredData(this.filter)
return {
};
}
...
ngOnInit () {
this.$ngRedux.connect(this.mapStateToProps.bind(this), null);
}
filterOnChange (text: string) {
this.filter = text;
}
I just don't want to store filter in a global state. So my question is - Is it ok to manually mutate this.props
with manually called mapStateToProps
?
Like this:
filterOnChange (text: string) {
this.filter = text;
this.props = Object.assign(this.props, this.mapStateToProps(this.$ngRedux.getState()));
}
Or is it better solution do exists?
redux state
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using redux with angularJS, but I guess it doesn't matter.
I have a component which filters data. It is looks like this:
filter: string = '';
mapStateToProps (state) {
const filteredRecords = Selector_Records.getFilteredData(this.filter)
return {
};
}
...
ngOnInit () {
this.$ngRedux.connect(this.mapStateToProps.bind(this), null);
}
filterOnChange (text: string) {
this.filter = text;
}
I just don't want to store filter in a global state. So my question is - Is it ok to manually mutate this.props
with manually called mapStateToProps
?
Like this:
filterOnChange (text: string) {
this.filter = text;
this.props = Object.assign(this.props, this.mapStateToProps(this.$ngRedux.getState()));
}
Or is it better solution do exists?
redux state
I'm using redux with angularJS, but I guess it doesn't matter.
I have a component which filters data. It is looks like this:
filter: string = '';
mapStateToProps (state) {
const filteredRecords = Selector_Records.getFilteredData(this.filter)
return {
};
}
...
ngOnInit () {
this.$ngRedux.connect(this.mapStateToProps.bind(this), null);
}
filterOnChange (text: string) {
this.filter = text;
}
I just don't want to store filter in a global state. So my question is - Is it ok to manually mutate this.props
with manually called mapStateToProps
?
Like this:
filterOnChange (text: string) {
this.filter = text;
this.props = Object.assign(this.props, this.mapStateToProps(this.$ngRedux.getState()));
}
Or is it better solution do exists?
redux state
redux state
asked Nov 7 at 6:03
Kindzoku
866621
866621
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184313%2fredux-mixing-local-state-and-global-state%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password