Skip to main content

All Questions

Tagged with
0 votes
0 answers
17 views

Update state, object with arrays

I would like to know how I could update this state: details: {id:{optionA: optionA, optionB: optionB, quantity:1 }} It would be something like this: details: [{ 1: {optionA: optionA, optionB: optionB, ...
ISMILIRDS IO's user avatar
1 vote
1 answer
103 views

c++ private and protected member inheritance

#include <iostream> using namespace std; // Base class class Base { private: int a = 10; public: void get () { cout << "Get:" << a << endl; } }; ...
jony's user avatar
  • 11
0 votes
1 answer
36 views

React State updates only from the second click event

i'm following a React course on udemy, and while doing a project to test my knowledge about state, i got into a bug i can't solve. The project is about coding an application that has three state ...
GianmarcoII's user avatar
1 vote
1 answer
54 views

I have a question about the single responsibility principle in state management in Flutter's Riverpod

Suppose you have code that manages bool type values like the following: (Made with Riverpod) final isPremiumProvider = NotifierProvider<IsPremiumNotifier, bool>(() { return IsPremiumNotifier();...
sub's user avatar
  • 662
1 vote
1 answer
47 views

How to copy an object function when updating nested state

I have two pie charts that display the ratio of completed tasks for a given period, and a number of medals received for the period. The issue is that the state contains a function that is responsible ...
Qaqli's user avatar
  • 179
1 vote
1 answer
15 views

failed to understand some js object behavior

console.log("hello"); var data = { data() { return { count: 0 }; }, plus() { return ++this.data().count; }, }; console.log(data.data().count); //0 console....
M.Jumman's user avatar
-1 votes
2 answers
40 views

Posting array of objects in React is giving me an extra object

I am trying to post an array of objects. They show up in my HTML but when I console.log it always gives me an extra empty object. Which my backend doesn't love. Here's the code on codesandbox: https://...
Nte's user avatar
  • 11
0 votes
1 answer
43 views

update the state of an object who's values are an array

I'm looking for a way to update a single index of an object's values that are an array while saving the state of the other values. I tried using a spread operator, but I'm getting an error. const [...
sal's user avatar
  • 74
0 votes
1 answer
43 views

React Js State Updates

Functional Component React Making a pizza website where you can buy pizza online. On the website, as online shopping websies, there is cart where you can add products. There is an array which has ...
yahya's user avatar
  • 3
0 votes
1 answer
34 views

I have problem when dynamically updating state in useState object

in my useState I have object with bunch of values. I have input and setting it's value to useState[key] dynamically it works. but problem occurs when I want to update values. when I am calling ...
irakli777's user avatar
0 votes
1 answer
28 views

boolean input to setState from mapped data

I've got this .map to map a list of checkboxes. I'd like to map the setState as well, and make in sort it dynamically points out the value binded to each column object: const [activeColumns, ...
Horkos's user avatar
  • 331
0 votes
2 answers
88 views

JS React: Two Objects, change properties if name matches

i have a problem with Objects in JavaScript (React). I have two different Objects, which are generated from two different XML-Files. Each Object has the same Names in it but the points and position ...
mrclbls's user avatar
  • 45
0 votes
2 answers
46 views

How to make an object of fix length in local storage

I want to store my radio button values in an object on local storage with index of the object as key of it. What should I do to make fix size array? Also I want to set that object as initial value of ...
jenish963's user avatar
0 votes
2 answers
99 views

setState not triggering re-render in React

Full component: const Column = ({ form, setForm, fieldset, blocks, selectedFieldsetId, setFieldBeingEdited }) => { //Sends block being edited to App component const editField = (e) => { ...
NekiMakiHaida's user avatar
0 votes
0 answers
87 views

How to append value to a state object?

I am creating a Polls application in React, where you can ask a question, set some answers, and let people vote. I am using one state to keep the question, and one state to keep the answers. They are ...
bogyz123's user avatar

15 30 50 per page
1
2 3 4 5
10