If I have a page with three cascading dropdownlists, is that an example of controlling the state of a web application (assume it is part of a larger application)?
I want to make sure I understand state management and the need for a system like Vuex and Redux and having the store pattern, one singleton to run it all through, reducing complexity, and so on I know the React and Redux folks said it'd be like wearing glasses, you know if you need them, and in addition, this could be done quite easily with no framework.
But, in general, is the usage of a cascading dropdownlist an example, albeit incredibly simple, of keeping track of "state"?
For reference of a dropdownlist see, https://stackoverflow.com/questions/18351921/how-to-populate-a-cascading-dropdown-with-jquery
jQuery(function($) {
var locations = {
'Germany': ['Duesseldorf', 'Leinfelden-Echterdingen', 'Eschborn'],
'Spain': ['Barcelona'],
'Hungary': ['Pecs'],
'USA': ['Downers Grove'],
'Mexico': ['Puebla'],
'South Africa': ['Midrand'],
'China': ['Beijing'],
'Russia': ['St. Petersburg'],
}
var $locations = $('#location');
$('#country').change(function () {
var country = $(this).val(), lcns = locations[country] || [];
var html = $.map(lcns, function(lcn){
return '<option value="' + lcn + '">' + lcn + '</option>'
}).join('');
$locations.html(html)
});
});
I don't think I was clear. I am only asking if the dropdownlist scenario is an example of State on the frontend. I did not mean was it the best way or a good candidate, only if it is an example, albeit incredibly simple. Another way, if I had a button that change colors based on some other choice on the page. Is that "State"? I'm only trying to understand what constitutes "State." It is not really a question about Vuex, Redux, or the like.