2,656
questions
0
votes
0
answers
62
views
Why is set state so slow here?
I have a custom chart with clickable points. After a point is clicked I want to change another component which shows that days commits to show the date of the point being clicked. In the parent ...
0
votes
0
answers
27
views
React: `setSomeState([..., x, ...])` update only applies to particular child element
Sometimes I want a parent element to keep track of the children's state. For example, a state that's a list where each item corresponds to exactly one DOM-child. In my application this is a multi-...
-1
votes
1
answer
29
views
reactjs - useEffect not getting updated value of state variable?
I am having an issue where everything inside my useEffect call does not seem to be getting updated state variables.
Before updating my state variable bboHistory with setBBOHistory, I print prev and I ...
-1
votes
0
answers
74
views
Flutter State Change not Registering
I am building a Flutter application and am trying to setup a record voice note button.
Intended Functionality: The recording starts when the user holds the button and stops when the user stops holding ...
0
votes
2
answers
27
views
i have bottom sheet for comments section; setState(() {}); not updating until any other action
one thing you have to keep in mind. i have create this class in external file and executing sheet from main code because same sheet needed in many of screens. so for showing sheet perfectly first i ...
1
vote
0
answers
17
views
getting maximum update depth exceeded error when trying to conditional render
Getting maximum update depth exceeded error when trying to conditional render a section inside render.
I have a component in which i need to render sections like below
export class Sections extends ...
0
votes
1
answer
49
views
How can I use the onClick functionality of one component inside another component in React?
I am creating a whatsapp clone.
For showing profile picture, I have made a card component which is accessed from a top_bar component.
function Show_dp(prop){
return(
<div id="box&...
1
vote
2
answers
52
views
Why is my setstate function causing other functions to malfunction in react.js?
const [lap, setLap] = useState([]);
function start(){
if(!isStart){
starting = Date.now() - elapsed;
isStart = true;
timer = setInterval(update, 1000);
...
1
vote
0
answers
30
views
e.nativeEvent.offsetX is 0 on mouseMove inside setState function
I have the following code that gets the cursor position on a canvas element. The code works fine in Chrome, but in Firefox, the e.nativeEvent.offsetX is 0 inside the set state function and outside is ...
0
votes
0
answers
18
views
How can I change contents of DataTable with setState
I have a problem. I am beginner for Flutter. I am making a share app and when I add a new share, it doesn't appear on DataTable. Here is my main page and share adding page code;
MainPage
class MyApp ...
0
votes
0
answers
29
views
How to change a baseUrl in a widget using a toggle switch?
Very new flutter user here. I am using the flutter_map and the toggle_switch packages. I want the toggle switch to change the base map when selected, but I'm really lost on how to set it up.
My ...
-1
votes
1
answer
38
views
setState not triggering a re-render when data has been modified(state type is variable)
I changed a state with setState, but it did not trigger a re-render. I considered it a minor issue, so I searched extensively, but I couldn't find a solution.
I want to check the second and third ...
0
votes
0
answers
30
views
How can I call a setter function inside of setState
I have the following class:
export default class Global {
public config!: Config;
public components!: Component[];
constructor(config: Config) {
if (!config) {
throw new Error("...
0
votes
0
answers
34
views
Flutter UI Screen doesn't update
I am new to Flutter and need some help. I am working on an App to choose between Eating Plans. In the setting screen I want the user to be able to make some changes on the plans. You can klick on a ...
0
votes
1
answer
30
views
async setState in react not effect
I have a app.jsx, which will request two different api named API_A & API_B. I will get data_A and data_B from this two api and merge them into a info state for render ui. My code is like this:
...
0
votes
1
answer
36
views
'onTap' isn't working, After fixing the "setState() or markNeedsBuild() called during build." error
I am building the BMI calculator app,
after all, it giving me "setState() or markNeedsBuild() called during build." error.
so, i come up with below solution..
onTap: () {
...
2
votes
3
answers
111
views
ReactSearchAutocomplete - set state not updating items, only updates on next search
I'm using ReactSearchAutocomplete to display a list of 10 suggested names from a mySql query. The query is performed with a 100ms delay on user input, and it works fine but I'm clearly not handling ...
1
vote
1
answer
70
views
Is it possible to update state within a useReducer
So here's my issue, im currently learning about the useReducer function and trying to utilize it to create a react based quiz, selection screen. I wanted to update the state (so it could be uplifted ...
1
vote
1
answer
53
views
Wrapping setState in NavLink callback gives bad setState warning
I have a Tabs component that has bunch of NavLinks. I'm trying to show a loading spinner based on the NavLink's isPending property on the parent component. So I'm showing spinner when there is a ...
0
votes
2
answers
46
views
How can I rebuild a widget after the StreamBuilder gets built?
I'm trying to get the totalValue in the title of the appBar. The value of totalValue comes from the Streambuilder and it changes everytime I press the FilterChips.
Code:
import 'package:flutter/...
0
votes
1
answer
35
views
React setState from fetch and send it to another fetch
I have a function that calls 2 functions, one uploads an image and stores it in some directory, and the other send product related data to edit/store in the database:
const uploadImage = async () =&...
0
votes
1
answer
37
views
Disabling Flutter ElevatedButton is not fast enough
I have followed the examples on disabling the flutter elevatedbutton after first press, but its not fast enough. Part of my onPressed makes a call to a backend server for data, but its somewhat of a ...
0
votes
0
answers
69
views
React-Infinite-Scroll-Component re-render error (Maximum update depth exceeded)
Good day. I am implementing a list page that will involve infinite scroll. I am getting my data from a Laravel API and I am fetching the data with react query. This page also has a search ...
0
votes
1
answer
113
views
Infinite Loop with Excalidraw and React Using Basic setState?
I'm trying out some very basic way of tracking the Excalidraw (0.17.5) elements in React, but I'm getting something like stack overflow. Why???
import { useState } from "react"
import { ...
0
votes
0
answers
16
views
Dropdown Rebuild Issue When Location Updates in Flutter
I’m working on a Flutter app where I have a dropdown widget that displays location data. The dropdown value is fetched asynchronously using a FutureBuilder. However, I’m facing two issues:
Dropdown ...
0
votes
1
answer
40
views
Default value of input 2 is from input 1. Why does the state of input 2 not get its default value from input 1?
I have 2 <input type="text"> elements. What users type in input 1 will be the default value of input 2. The value of input 2 will be used for other tasks. The tasks should run right ...
-1
votes
1
answer
48
views
React setState not rerendering
Started a course on ReactJS and on Chapter 4 I encountered this issue. I have verified with several posts and none work. setState() is any implementation has not re rendered the component.
const ...
0
votes
1
answer
37
views
Dropdown Values not change in Flutter Modal
I have this Dropdown Widget in a Modal and I cannot Change the Value in the Widget while I'm using setState and everytime I change the value, I should close the Modal and then the Value is Changed.
...
0
votes
0
answers
72
views
How to update array using its index in ReactJS? I want to put the value of an object at a particular index in array using setState [duplicate]
I want to put the value of the state object 'nm', to the array 'Names[]' at a particular index 'uid'.
Please check this code-
this.state={
Names:[], nm:'', status:false, uid:''
}
...
0
votes
0
answers
31
views
SetState does not work to update the data in a widget
I have a DashboardScreen which is accessed from bottom navbar , and another screen called CollectionScreen also is accessed from bottom navbar, when i create a collection on collection screen i need ...
0
votes
0
answers
104
views
Using set state from a dialog box with StatefulBuilder in flutter
I am trying to make a simple social media app and I am using a alert dialog for the user to add a new post. Im trying to update the alert dialog using statefulBuilder when I add an image but the image ...
-1
votes
1
answer
32
views
React setState changes the value of all objects in different state variable
Here's my code:
import "./styles.css";
import { useState } from "react";
export default function App() {
const [input, setInput] = useState("")
const [list, setList] ...
0
votes
0
answers
36
views
React update object array with values from another array of objects
In my project I am using a textbox where user can paste a text with a set of questions and answers. I need to get the input split each line in an array and add an object to the setState array with ...
0
votes
0
answers
58
views
React current elements class change code not working with setState
In my application I am using an ul and li tags and when one li is clicked the application is changing its background color with a class. I also wants to save the value of that li tag. I am trying to ...
0
votes
0
answers
25
views
ReorderableListView not updating after using Get.changeThemeMode in Flutter
I am currently developing an app in Flutter and I stumbled upon a bug. I have a ReorderableListView that works just fine with one exception, that being when I use the button that I created for ...
0
votes
1
answer
48
views
SOLVED! setState() or markNeedsBuild() called during build ,stuck on this although the app work normally
This is my home screen and it is working fine but it is throwing error each time I navigate to it.
I don't know what to do , all of the app is working normally , it is just throwing this errors and I ...
0
votes
2
answers
66
views
How to call setState in an app wide function?
I have a an app-wide file that has several functions that are used several places in the application. In one of those functions I want to call setState. This causes an issue because the function is ...
0
votes
2
answers
56
views
I cannot display a changing value on the screen in my flutter application
I uploaded 3 pages of related code here. My problem is this: I press the Pick Country button and select a country, but I can't display my screen the phoneCode parameter of the country I selected.
I'm ...
0
votes
1
answer
36
views
React response from fetch as json
The fetch statement getting json data from the server. I want to get the value of the object to be saved in state. The response is only one element in it [{"QuestId":1700}]. How to get the ...
3
votes
1
answer
672
views
Flutter FutureBuilder keeps Firing and rebuilding. It Generates a New Random Number on Every Rebuild - How can I Prevent This?
Context
I am encountering an issue with FutureBuilder in Flutter where it recreates its Future on every widget rebuild, causing unexpected behavior in my app.
Specifically, I have a FutureBuilder that ...
0
votes
1
answer
176
views
Best approach to get the current state value
I want to know what's the best approach to get the current state value.
I figured out 2 options to reach the current value instead of getting stale value by whether using useEffect hook or using the ...
2
votes
2
answers
251
views
Why does Flutter PageView resets to page 0 after setState
Above the first Page that shows, I show a message that the user can swipe left to go to the next page. In onPageChanged I set a bool to dismiss the message and call setState. When I swipe to page 1, ...
0
votes
2
answers
85
views
Why Does setState in a Component's Body Cause an Infinite Rendering Loop?
According to the React official documentation, setState should only trigger a re-render if the current value differs from the new one. However, I've encountered a scenario where my code enters an ...
4
votes
2
answers
343
views
react's useState does not sets new state
I have the following frontend:
AuthContext.js:
const { createContext, useState, useContext } = require("react");
const AuthContext = createContext();
export function useAuth() {
return ...
-2
votes
1
answer
61
views
When using useEffect (with an enclosed setState and a fetch), are there any issues to be be aware of when using async/await vs Chaining .then?(NextJS)
Please note - this is NOT a generic Javascript question about async/await vs. .then. If you are curious about that, please look here: Difference of using async / await vs promises?.
This is a ...
0
votes
0
answers
29
views
useEffect render previous value, instead new setState
Im trying to set set an IP address into "" and (last queried value).
But its always render same state and render new state after second render.
I know its because of setState syncronomous ...
0
votes
1
answer
35
views
How to loop over a const object in ReactJS
I have a const in ReactJS which is an object and I want to loops over it to set all values to undefined to reset the state and re-render the component to get a clean form
const [newPayee, setNewPayee] ...
1
vote
2
answers
171
views
Flutter Not Calling Build in a Widget After setState() Despite a Change in State
I have called setState() to update the objects of the class MyErrorBox, but Flutter does not run the build function for those objects. I am new to Flutter and coding in general. The MyText class in ...
-1
votes
1
answer
39
views
react setValues hook is not working properly
I have an array of files that will be uploading, but I want to change the array of file strings to an array of objects which is working fine. But when I try to update the variable to the new array, it ...
1
vote
0
answers
32
views
Is it poor practice to set state within JSX?
I'm working on showing a series of images with next and previous arrows. I don't want the next and previous arrows to show until the image loads. I have a state variable to track when the image loads....