Questions tagged [state]

The contents of memory locations, at any given point in the program's execution, is called the program's state.

The contents of memory locations, at any given point in the program's execution, is called the program's state.

More information is available on Wikipedia.

9107 questions
2
votes
4 answers

State Machine approach for simple state transitions

I am looking into creating a very simple state machine. My state machine will contain the following 3 states: public enum States { PENDING, ACTIVE, DONE } There are multiple transitions + starting states that are possible here,…
thebighoncho
  • 385
  • 2
  • 6
  • 20
2
votes
1 answer

Function from previous screen still calling when pushed to new Screen in Flutter

I am new to flutter. I have two screens. My first screen is Stateful, it consists of a list view, which is developed using FutureBuilder, when I select an item, I am pushing the app to a new screen which is also of Stateful type. When I am moving to…
Rob13
  • 381
  • 8
  • 20
2
votes
1 answer

Toggling Between State Value - Toggle Function

In my React App, I have a functional component and wanted to toggle between a state's value. My toggleNav function doesn't seem to working. I'm trying to set isMenuOpen to what isMenuOpen is not but my syntax seems to be incorrect. I have the…
Eric Nguyen
  • 926
  • 3
  • 15
  • 37
2
votes
2 answers

How change component state without resetting final-form values?

I have a component that contains a form made with react-final-form; all the input fields work fine as in all my other forms, however, i have one custom input that i need for changing the state of the component, and then in the handleSubmit i would…
xunux
  • 1,531
  • 5
  • 20
  • 33
2
votes
2 answers

Why isn't my first click being registered in state in my React container?

I'm working on a matching game and have written a handleClick function that should increment a state value called guessCount so I can keep track of each time a player guesses. I also want to save the IDs of each item clicked as guessOne and guessTwo…
2
votes
0 answers

How do i correctly create event handling for the state of a second level element in a nested array (React)

I'm using React-PDF to dynamically create a PDF-document when a user enters info into textareas in a form. The form data is saved into an array which also contains a nested array among the regular fields. The basic form is working great as of now…
straycat
  • 21
  • 1
2
votes
1 answer

Why is my state counter one value behind what it should be?

Im new to reactjs. Im trying to create a comment section for some uploaded files, and keeping a counter on the comment buttons attached to each file. However, the counter is returning strange values. Here is the relevent code: class ListItem…
Sean Barker
  • 351
  • 1
  • 3
  • 14
2
votes
1 answer

Sending a state to a parent component

I'm using a checkbox to add/remove a data to a state(which is an array of strings). checkboxClick(e, contact)} /> The onClick do this and…
2
votes
3 answers

How to access an element of the nested multidimensional array filtered by the given ID?

I'm storing default values of multiple radioGroups in an State array object in react. Current state object formRating has about 22 elements where in each is radioGroup's defaulValue is stored Once stored into the state, the array object looks like…
Dworo
  • 153
  • 1
  • 4
  • 15
2
votes
3 answers

Did I create a global state by accident?

I am building a React web app which is split up in multiple components accessible via react-tabs: import React from 'react'; import ReactDOM from 'react-dom'; import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; import a from…
leonheess
  • 16,068
  • 14
  • 77
  • 112
2
votes
3 answers

Why the function argument returns undefined when using props?

I am building an app using react-native. I have 3 components namely Ind.js, Buttons.js, Rain.js. I am required to select an option in Rain and save it in the state of Ind for further processing. Since Rain component is not directly related to Ind…
random_user
  • 71
  • 1
  • 9
2
votes
2 answers

getting button value in onChange event

I am trying get the button value in a onChange event.Later I will have to bind the value to state. But I am getting an empty value. This is the event…
jack
  • 351
  • 5
  • 23
2
votes
1 answer

Difference between using hook useState and declare variable

What's the difference between function Example() { const [count, setCount] = useState(0); and function Example() { const count = 0; with respect to the semantics of the count variable? In addition to the existence of the setCount method, what…
ewerton
  • 427
  • 1
  • 6
  • 13
2
votes
5 answers

What is the best approach for implementing enable/disable methods in Java?

In Java, given a pair of public methods, enableFoo and disableFoo, that set a boolean field named isEnabledFoo to true or false, respectively, should the method check to see if Foo is already enabled before setting? If yes, should an exception be…
user711807
2
votes
3 answers

Opening modal using NGX and state management

I'd like to use NGXS to open modal which will set column visibility for datatable. Here is my code: state.ts file: @Action(OpenColumnModal) openColumnModal(ctx: StateContext) { const state = ctx.getState(); const allCols =…
Crava
  • 76
  • 7