Questions tagged [state]
The contents of memory locations, at any given point in the program's execution, is called the program's state.
state
9,229
questions
-1
votes
0
answers
23
views
How to Normalize Input Data for a Reinforcement Learning Agent in a Simple Game [closed]
Question:
I'm developing a simple game with a map, a player, and some enemies. The goal of the game is for the player to gather points on the map while avoiding being caught by the enemies. I've ...
1
vote
1
answer
44
views
React state gets updated but changes are not reflected in an event listener called programatically
This is a socket.io chat app, where I am trying to add a keyboard shortcut. I am listening for the "keydown" event and calling the button click listener function (which is also throttled) ...
0
votes
0
answers
10
views
AsyncTelebot message handler not working with a state
I have a problem with states in AsyncTeleBot. message handler not working with state, and i don't have any idea, whats going wrong. Code is below here
bot = AsyncTeleBot(token, state_storage=...
0
votes
1
answer
51
views
re-render input component not losing focus when re-rendering
I present two different ways to render an input component;
E.g.1
function myComponent(){
const [st, setSt] = useState('');
return <...
0
votes
2
answers
60
views
How to make view reflect binding object's properties changing internally in SwiftUI?
In this code below, I want the TextField value to be cleared when the button is selected and the object's clear method is called (in reality, my class has many properties so I feel like clearing them ...
1
vote
1
answer
25
views
Input unfocused after I type character in my react input field, I think its target issue
If I type anything in my react input field, then it allows me only one character to type and then focused goes outside of the input field and then again I click on input field the allow me to write ...
0
votes
0
answers
59
views
State is reverting back even after i confirmed its change
so when i click evalute this expression '3+5*6-2/4' then result state is set to 32.5
after that clear function is being triggered and it sets the state to '' and after that when i press 5 it reverts ...
0
votes
1
answer
24
views
How to make sure state updates that are fired off in succession all execute
If I have multiple state updates that all fire off in rapid succession, the initial state updates will not fully update because they will be overridden by later state updates. How can I make it so ...
0
votes
0
answers
19
views
Hide child component from parent with transition
I created this modal component:
interface ModalProps extends PropsWithChildren {
/***/
onClose: () => void;
}
const Modal: FC<ModalProps> = ({
/***/
onClose,
children
}) => {
...
-2
votes
1
answer
67
views
Must the @State variable be updated in the main thread? [duplicate]
Some articles say that the @State variable has to be updated in main thread. But I did some tests and found it is ok to update @State variable in background thread. This is my code:
import SwiftUI
@...
0
votes
1
answer
49
views
Lifting state through multiple child elements
Bit stuck on this. I have a Main parent component that goes to a Search component which then goes to a Select component. The search asks for a city and then goes to an API and brings back 5 search ...
0
votes
1
answer
34
views
how to keep constant variable on react rendering
i've got stuck in react problems.
I've create an online shop (front-end) website in react
const products = [
{ id: 1, name: "Oppo", price: 200, unit: 1, img: "oppo.jpg" },
{ id:...
0
votes
1
answer
58
views
MKMapView not retaining state?
I have an extremely simple set up in which a MapKit resides within another view. I want the map to be able to be expanded into a fullScreenCover. The map properly shows up in ProfilePageView on ...
0
votes
2
answers
52
views
Composable not recomposing when state is changed inside the ViewModel
I am trying to show a circular progress indicator, when syncing of files start by setting syncing state to true.
when syncing ends the variable becomes false.
This is the code of my MainViewModel.
...
0
votes
2
answers
32
views
i have an issue regarding firebase authetication with react js
On login i'm storing user token or id in local storage and then i'm getting them from local storage and saving in state and on state behalf its selecting routes but if user is login and is in local ...