All Questions
Tagged with react-hooks arrays
885
questions
0
votes
1
answer
21
views
useState returning empty array on default state, using react + supabase
I need help to understand why when I console.log(menus) on Menu.jsx it returns an array of values, but if I console.log(item) it only returns an empty array, while the default value of the item is &...
2
votes
2
answers
49
views
How to reset my useState to it's initial state after filtered list has rendered?
I am having trouble figuring out how to reset my projectList to it's initial state so that way in the filterProjects function it is filtering through the entire projectList and not the already ...
0
votes
0
answers
24
views
how to modify my useDocumentTitle hook to support and display Product {itemNo}
i do not know how to modify my useDocumentTitle hook to be able to use Product{itemNo}
in the website when you choose a product and the page opens to it and all it's details are shown, on the browser ...
0
votes
1
answer
31
views
React: when an element in an array gets deleted, all subsequent elements gets re-rendered, while the previous don't
In this project (React with NextJS), the user can see various statistics, statistics like how many orders a certain rider made, how many hours it worked and so on. The user is not limited to just one &...
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
65
views
How can I reset an array in a React state after a successful fetch request?
So, I'm collecting cellphone numbers from a textarea: the values are held in state.
I will validate them and/or add a country prefix based on whether or not they already have the prefix. For each ...
-1
votes
1
answer
51
views
useState set method not changing my state - react native
I'm working on a part of an application dealing with a deck of cards. For however many cards a player is supposed to have, I am looping through a deck of cards held in a state, randomly picking a card,...
1
vote
1
answer
57
views
Cannot pass data from one page to another using useState on button click
I am running a function when the user clicks a button, this function updates my useState and adds an array into it as data. This data later on is passed into another webpage where the array objects ...
0
votes
2
answers
26
views
Timestamp array list covert hours minutes Seconds into setInterval time for each 1 seconds
Hi everyone facing one issue in my react application where I have array of list timestamp's ex:([1651234567, 1651234568, 1651234569]) which I need to convert in to hours minutes & seconds like Ex:(...
-1
votes
2
answers
41
views
How can I implement the inputSearch component so that users can find a certain task by typing a couple of letters? [duplicate]
For now, I have almost finished implementing the functionality for users to find a certain task. I am using a variable called isTaskListEmpty to render different content depending on its state. But ...
1
vote
0
answers
65
views
explaining why React Hook useEffect has a missing dependency [duplicate]
I'm new to React, but why vs code is showing me this message in the problem tab
isn't adding currentNoteId to the dependence array will crash the app
const [notes, setNotes] = useState([]);
const [...
0
votes
0
answers
42
views
dropdown is close when i click outside and whene i click in the <li> is not closed
This is my useEffect function for if i click outside of the liste it will be closed
First when i click in the <li> the list is showed but when i click again in to <li> it doesn't closed
...
0
votes
1
answer
73
views
Filter array by object value deletes the wrong object
I'm using react with context and I want to delete an object. Here's my code
Context.js
export const postsReducer = (state, action) => {
switch (action.type) {
case "SET_POSTS":
...
0
votes
0
answers
21
views
Email.js:247 Uncaught TypeError: Cannot read properties of undefined (reading 'id')
When ever I click on the particular data on the list the data is consoled only for the params. And it is not setting that data for selectedRow and also not consoling this part if (!selectedRow) {
}
...
0
votes
0
answers
20
views
Retrieving data to an array returns empty [duplicate]
I created a simple application using Node, React and Mongo. When I try to retrieve the data from Mongo, the array to which I'm trying to populate the data returns an empty array.
Adding Data works ...