All Questions
353
questions
0
votes
0
answers
22
views
React Leaflet Marker Change Rerenders Every Other Marker Causing Performance Issues
I'm trying to build a quick leaflet map akin to Apartments.com. It's a map with a bunch of markers (up to 2000 in my case) and it will have a sidebar with more in-depth details about the markers that ...
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, ...
-1
votes
1
answer
95
views
React removing all entries from a state array rather than one with filter()
SO as the title states im running into an issue with my react code that whenever i try and remove an item from the array it clears the state entirely (back to [])
My current code looks like this:
...
0
votes
1
answer
45
views
How to keep track of changes of objects in my array
I try to develop my first app, which is a quiz app.
Here is my class for the Quiz player:
class QuizPlayer: ObservableObject {
@Published var name: String
@Published var points: Int
@...
0
votes
1
answer
138
views
React: Passing API Data from State in Parent to Child Component to be Mapped out
I am new to React and every single time I think I understand state, I run into issues, this is one of them. I have a parent component which is a form that has a child component that is a select. The ...
0
votes
1
answer
25
views
React_Access to state array
I need to update state of my array order conditionally (checking for duplicates), but can't access order values inside function addToBasket.
At the same time it's updated and I have an access there in ...
0
votes
0
answers
314
views
runtime-core.esm-bundler.js:41 [Vue warn]: Property "tasks" was accessed during render but is not defined on instance
I'm new to stack so pardon my etiquette. I'm currently learning Vue and Vuex for a job interview and was tasked with building a todo list. When I converted everything over to Vuex, the input for new ...
2
votes
1
answer
24
views
React-Native : Please correct my misunderstanding about how state works - Dynamic text inputs
This is 100% me just misunderstanding how state works in React-Native, and I'm hoping for an illuminating correction.
I've declared my state :
const [players, setPlayers] = useState(["",&...
0
votes
1
answer
609
views
Updating state for an element of a @Published array, doesn't refresh the view
I have the following LocationToggleable class, which I have attempted to make an observable object, as well as a struct, and various other attempts. This object is being maintained by a ...
0
votes
0
answers
23
views
I want to know if it is alright to create a shallow copy of a state that contains an array with objects [duplicate]
Let's say I have this as a state in react :
const [cars, setCars] = useState([]);
The cars array contains this :
[{id: 0, brand: 'BMW'}, {id: 1, brand: 'Audi'}];
And I create a copy of this state :
...
0
votes
0
answers
42
views
Why is my array only storing one item and replacing the old item with the new one?
I have a checklist component on a React form. When an item is checked, I want to immutably add it to checkboxVal state array, when unchecked, I want to remove it. Currently, when I check a new value, ...
0
votes
2
answers
496
views
Cleaning up state on useEffect hook
Can someone give me a light on what may be happening here? I have an effect that basically, when I load a product page it updates an state with an array of items, but when I change the product (a prop)...
0
votes
1
answer
38
views
State array not updating in child component loop - array is overwritten
I have a very interesting problem.
I am building a game that has 9 grids(arrays) that also has 9 grids (arrays) inside.
The way I am rendering the board is this way:
function MainComponent() {
// ...
1
vote
2
answers
49
views
How to update state so it's reflected in child components
I am learning React and now I am making a very basic shopping list app. I wanted to increment the amount of existing items in the list, instead of adding duplicating items (with the same name).
I have ...
0
votes
2
answers
61
views
I need to remove items from an array dynamically when the value is been changed in react
I need some help removing values from an array.
This is the array
[
{
"label": "One",
"value": "one"
},
{
"label": ...