Questions tagged [state-management]
1074 questions
171
votes
5 answers
Returning Promises from Vuex actions
I recently started migrating things from jQ to a more structured framework being VueJS, and I love it!
Conceptually, Vuex has been a bit of a paradigm shift for me, but I'm confident I know what its all about now, and totally get it! But there exist…

Daniel Park
- 3,903
- 4
- 23
- 38
150
votes
6 answers
Angular 6 - Why use @ngrx/store rather than service injection
I am recently learning Angular 6 with @ngrx/store while one of the tutorial is to use @ngrx/store for state management, however I don't understand the benefit of using @ngrx/store behind the scene.
For example, for a simple login and signup action,…

Drex
- 3,346
- 9
- 33
- 58
71
votes
8 answers
Cache VS Session VS cookies?
What are the do's and don'ts about Cache VS Session VS Cookies?
For example:
I'm using Session variables a lot and sometimes have problems in a booking-application when users start to order products and then go to lunch and come back some hours…

Stefan
- 11,423
- 8
- 50
- 75
47
votes
5 answers
ChangeNotifierProvider vs ChangeNotifierProvider.value
I am quite new to this framework and working on state management using provider package where I come across ChangeNotifierProvider and ChangeNotifierProvider.value, but I am unable to distinguish their use case.
I had used ChangeNotifierProvider in…

Avnish Nishad
- 1,634
- 1
- 17
- 18
39
votes
2 answers
What is state management in angular? and why should I use it?
I am new to Angular and this question might be very broad. But I am interested in learning more on State management usage. Recently one of our project implemented state management using NGXS library. However I am trying to understand what are all…

ac184
- 811
- 2
- 10
- 19
32
votes
3 answers
Triggering initial event in BLoC
example_states:
abstract class ExampleState extends Equatable {
const ExampleState();
}
class LoadingState extends ExampleState {
//
}
class LoadedState extends ExampleState {
//
}
class FailedState extends ExampleState {
…

vendrick
- 478
- 1
- 5
- 12
32
votes
6 answers
How to use data from Provider during initState in Flutter application
I am refactoring my Flutter application code by adding Provider as a state management.
Desired behavior: When Home screen opens, app should check if users email verified, if it's not then should show dialog popup.
Problem: It worked fine when I…

Maxim Vershinin
- 531
- 1
- 6
- 12
27
votes
11 answers
Flutter: How to listen to the FirebaseUser is Email verified boolean?
My Idea:
I want to use the Firebase Auth Plugin in Flutter to register the users.
But before they can access the App, they have to verify their Email address.
Therefor I push the Firebase users after registration to a verification screen. This is…

eifachtimon
- 283
- 1
- 3
- 7
25
votes
2 answers
Backbone.js state management / view initialization based on url fragment
I'm trying to keep track of the state in this app using Backbone.js:
I have a "ChartAppModel" with a set of defaults:
ChartAppModel = Backbone.Model.extend({
defaults: {
countries : [],
selectedCountries : [],
year :…

dani
- 4,880
- 8
- 55
- 95
24
votes
3 answers
react-query: Refetch Query only if the state variable is changed
I have a select option menu. So, When a user selects an option, I want send a GET/ request to the server with that option and recieve the filtered data from server.
This can be achived using useEffect(() => {// send the request},…

Ashik
- 2,888
- 8
- 28
- 53
22
votes
2 answers
How to use patchState vs setState in NGXS?
I am learning ngxs but I can't understand when should I use patchState and setState? What's the difference?
const state = ctx.getState();
let data = this.service.list();
ctx.setState({
...state,
feedAnimals: data
});
vs.
let data = …

Александр Шатилов
- 331
- 1
- 2
- 7
18
votes
3 answers
Correct way of Creating multiple stores with mobx and injecting it into to a Component - ReactJs
As suggested here in the Mobx documentation I have created multiple stores in the following manner:
class bankAccountStore {
constructor(rootStore){
this.rootStore = rootStore;
}
...
class authStore {
constructor(rootStore){
…

uneet7
- 2,925
- 7
- 24
- 41
16
votes
3 answers
Preserve widget state when temporarily removed from tree in Flutter
I'm trying to preserve the state of a widget, so that if I temporarily remove the stateful widget from the widget tree, and then re-add it later on, the widget will have the same state as it did before I removed it. Here's a simplified example I…

Arthur Facredyn
- 1,017
- 1
- 9
- 16
15
votes
3 answers
How to persist state between tabs (TabBar) in Flutter?
I have a TabBarView with 3 TabBar. When I'm in tab 1 I do something, then I navigate to tab 2 when I come back to tab 1 I want to the previous state of tab 1 will not change.
How can I achieve this in Flutter?
Below is my code screenshot
class…

Hoang Trung Nguyen
- 409
- 7
- 16
15
votes
1 answer
How much of this business logic belongs in Vuex?
I have a simple app which pulls products from an API and displays them on-page, like this:
I've added Vuex to the app so that the search results as well as the product search array doesn't disappear when the router moves the user to a specific…

dsp_099
- 5,801
- 17
- 72
- 128