828
questions
-1
votes
1
answer
41
views
React Native Warning: Each child in a list should have a unique "key" prop. in JavaScript map function [duplicate]
I am not able to get rid of it with this warning
Warning: Each child in a list should have a unique "key" prop.
Here is the complete code:
const App = () => {
const userList = [
{
...
0
votes
2
answers
62
views
How to Return Total of the month based on dates in JavaScript(React)
I wrote a hook to calculate sales based on month-to-set data for the chart.
It works fine, but I'm not satisfied.
is there a different or easy way to avoid repeating and make code clean and extendable?...
-1
votes
1
answer
81
views
Correct use of Javascript map function [duplicate]
I am trying to use map function in my code, but I am afraid that I am making some silly mistakes. It just does not work!
Here is my code. I have 2 buttons captioned "ID" and "Text"....
1
vote
0
answers
50
views
image don't render in react (django + react with vite project )
Hello I'm trying to develop a blog using django as a backend and react on the frontend. i've written a map function on the frontend to loop through the blog articles, all other field elements appears ...
0
votes
3
answers
42
views
Checking content of a map function inside return section of React js
How can I check in React if a map function is empty or not inside the return section? wanna check If it's empty, if so render an empty array, otherwise wanna render everything by mapping the content. ...
1
vote
1
answer
66
views
How do I display an array object in map onClick for modal?
I'm fairly new to React and I'm using NextJS. I have an array with role objects. I'm mapping over the array to display role name and description. What I'm trying to do is display the other array ...
0
votes
1
answer
46
views
how to apply useEffect and map function without repeat more than one a time
I have a component in react native that gets data from mongodb
const Num = () => {
console.log("how many times do you see this message?")
const [data, setData] = useState([])
...
0
votes
0
answers
58
views
Slider is not working in modal in reactjs
Getting an array of images (imageList) using prop and I mapped that array in a grid. I want to show a slider of same array of images in modal after clicking on any image of the grid (starting from the ...
0
votes
3
answers
88
views
TypeError: uniqueCategories.map is not a function
I'm new in Next and Typescript and can't solve the issue, I have tried all possible options that found in the internet and thinking maybe the problem is that the answers were old and something have ...
0
votes
1
answer
227
views
A way to mutate a new column in every dataframe in a list of dataframes?
I have a list of files that I want to import as tibbles, then mutate a new column onto each tibble based on an ifelse statement for a threshold. I didn't want to use a loop, so I have been trying to ...
1
vote
1
answer
85
views
TypeError: data.map is not a function in react and django
I'm using Axios to retrieve data from the backend. When I log the data to the console, it appears as an object. However, I need the data to be in an array format. When I try to use the map function on ...
0
votes
1
answer
599
views
is map function is not working in next js 13.4.17 or above
i am using next js 13.4.19. i have made a GET api and trying to access the data available at mongodb database. but when i try to map the data it shows me error
Error: data?.map is not a function.
This ...
1
vote
1
answer
44
views
how to change value on nested list use map function in R
Need help I have nested list, I would like to change all the value of the photo become empty list, the list are below :
df <- list(messaging = list (telegram = list (registered = 'true', photo = c(...
0
votes
1
answer
36
views
React .map doesn't work while trying to set data for displaying on the chart
I want to display data from API on the chart and I know how to do it but I have error while using .map function. I want to separate prices[0]from prices [1] to have access to two of them because my ...
0
votes
1
answer
106
views
How to return the correct data in a map() function in react-native
When I input data into my Text input, it goes into this array
WorkoutItems([...workoutTextItems, workoutText, setsText])
I want to get my data individually from each item, so for example, workoutText ...
0
votes
1
answer
30
views
How to get unique and returning users count from overall user enteries with a user key in couchDB
I have a key called 'username' that stores the user logic records with a unique user id in couchDB. Now I want to get unique users count and returning users count from those records with the help of ...
0
votes
1
answer
68
views
why is it consoling an empty array?
const testFolder = '../assets';
const fs = require('fs');
const array=[]
const pattern=/gif/
fs.readdir(testFolder, (err, files) => {
files.map(file => {
if(file.search(pattern)>0)
...
1
vote
3
answers
77
views
Mapping Array of Arrays into a List
I have an Array of answers, sorted by the question they belong to, like this:
sortedAnswers= [[Answer1, Answer2, Answer3, Answer4],[AnswerA, AnswerB, AnswerC, AnswerD]...]
I'm trying to render a ...
0
votes
2
answers
69
views
Map an Array of Arrays of Objects [closed]
I'm trying to map the text of a database of given asnwers in a List for my quiz App.
The problem is that i have to acces the title in an array of array of objects like this:
log of the database in ...
0
votes
2
answers
91
views
How do i capitalize the first letter of each sentance in Javascript? [duplicate]
How do i capitalize the first letter of each sentance in Javascript?
(I am creating a tool that would convert first letter of each sentance to upparcase(Sentance Case) on click in reactjs)
I want ...
5
votes
2
answers
266
views
Use Map function with the base R pipe |>
How can I use the Map function with the pipe base |>?
The next x vector can be used inside the Map function
x <- c(1,5,1,2)
Map(function(n)n*2, x) |> unlist()
# [1] 2 10 2 4
This works, ...
-4
votes
1
answer
40
views
I have a problem in my react class base component by using the setstate [duplicate]
I am trying to fetch API and show the result in my next react component but if I can set the state in the componetmountfunction it can cause the error:
this.state.articles.map is not a function.
...
0
votes
2
answers
136
views
Python multiprocessing issue with passing multiple variables / global variables into function
When I run the code below, the global variable 'ticker' is not defined in the compile() function.
Goal: How do I pass multiple variables into the multiprocessing pool.map() function to make this code ...
1
vote
1
answer
48
views
Condition rendering of photo using map
I'm trying to render a specific photo based on the input from a user. I map over the users information and get all the fields right except the img field where I try to add a conditional statement.
...
1
vote
2
answers
80
views
How releve model within map function in dplyr
I have the following dataset
dput(dat2)
structure(list(g = c("Women", "Women", "Women", "Women", "Women",
"Women", "Women&...
0
votes
1
answer
110
views
cannot use the map function on nested dataset
I have the following dataset
# dput(head(dat, 130))
dat <- structure(list(
Gender = c("Women", "Women", "Women", "Women", "Women", "Women&...
0
votes
0
answers
21
views
independently update the state of a attribute of a item in an array which are return using map
this is my entire code
import { FormButton } from "../../shared/SharedElements/Buttons";
import { Header } from "../../shared/SharedElements/SharedElements";
import \* as l from './...
0
votes
1
answer
468
views
Cant acces array[0] of rows returned by exceljs
this is my first question and I hope someone can help me, I need to convert an excel to json to upload the data to a DB with Angular and exceljs, I've been trying a lot of things but I could not find ...
1
vote
1
answer
147
views
How to use map with a list of lists
I am needed to use map on a list of lists in Scheme (Racket).
What I want specifically is something like (map-lists add1 '((3 1) (2 8))) => '((4 2) (3 9)).
I know how to solve this recursively, ...
1
vote
1
answer
128
views
TensorFlow Dataset - how to make map function return multi columns as one tensor
Question
How to write a map function that generates a TensorFlow dataset where each row is a multi column tensor?
Problem
Here is a dataset.
import tensorflow as tf
dataset = tf.data.Dataset....
1
vote
2
answers
1k
views
How to use <br> Tag within React map function loop
I loop through an Array of objects in ReactJS where I use map function to loop through each Object. So Can i use tag to separate each objects in next line. I tried to put a tag at the end of the ...
0
votes
2
answers
87
views
map through list stored in state - react
I'm trying to map through a list that is stored in the state and pass each item in the list as a prop to another component. Here is what it looks like. The video component is supposed to receive each ...
0
votes
1
answer
28
views
Limit mapped items in a loop [duplicate]
I've searched other posts but couldn't quite find I was looking for. I am looping through data from a sanity api but I want to limit it to just the first 4 items returned. What would be the best way ...
0
votes
1
answer
840
views
Proper way to return a map function
I have the map function.
function test2() {
let data = [
["a","aa","aaa"],
["b","bb","bbb"],
["x&...
0
votes
3
answers
496
views
Python How to pass specific key from list of Dictionary to Map function
I have data in below format:
and I have function which accepts 2 keyword argument
I am unable to come with syntax or example where i can pass specific keys from list of dictionaries to Map function ...
0
votes
2
answers
93
views
Python: Call function that returns two strings inside map function
Hello I am trying to create a function that is called inside a map function, splits the string that have been passed as input and returns two processed strings. To be more understood here is my code (...
0
votes
1
answer
244
views
"Key" prop in map
Newbie here, Sorry for the silly question :)
How am gonna put the "Key" prop in this function?
The code is on the above of ContactShadows. I tried many ways but all the methods I tried are ...
0
votes
2
answers
621
views
Using Map function inside of another Map function in React Js
I want to add genre to my Movie Search app's carousel using map function. I have two json files one of them is an array of movie data as objects having a key as genre_ids eg:
genre_ids: 0: 16 1: 28 2:...
0
votes
1
answer
927
views
Add Search functionality using a input search field state in ReactJS
I have made a ReactJS application to display the items from a restaurant menu by making use of an API.
My API data is in this way:
[
{
"Name": "Chicken pizza",
"...
1
vote
2
answers
72
views
reduce and map: how to get the same results
I am using a reduce and my code works correctly, however, I was trying out using a map, but not sure how to implement it. Any help would be appreciated.
What does the program do?
Below I am fetching ...
0
votes
1
answer
1k
views
Function scatter_mapbox returns only blank maps. How to solve it?
I'm trying to use the function "scatter_mapbox" from plotly.express and everything I get back are blank maps. I'm having this issue in Jupyter Notebook with Python 3.9.12. I have tried to ...
1
vote
0
answers
356
views
Using a map() function as a condition
I have two DataFrames, one gets daily new inputs via Id number and gives the related value. The other one corresponds to a "catalog" that lists all existing Ids and outputs the name of the ...
0
votes
1
answer
97
views
Save csv files using filenames in a map function loop
I am looping a number of csv files in a folder using the map function. I want to save the results of the loop using a sliced version of the name of the csv. But I am getting an error when attempting ...
-2
votes
1
answer
45
views
How to convert this loop to a map?
How could i get the same result with a map? i'm a beginner trying to learn how maps relate to iteration. Is it possible to put this loop into a map?
user_list = [int(input("what is the fist ...
1
vote
1
answer
56
views
Pyspark lambda operation to create key pairs
I already have code which maps to this
['vita', 'oscura', 'smarrita', 'dura', 'forte', 'paura', 'morte', 'trovai', 'scorte', 'v’intrai']
I want this
[('vita','oscura',1),('oscura','smarrita',1),('...
0
votes
1
answer
678
views
Python map() function with an existing list [duplicate]
might be a dumb question but why when I try to use map() function on an already existing list:
nums = [1,2,3,4,5]
result = map(lambda num: num+num , nums)
print(result)
it returns me: <map object ...
0
votes
1
answer
60
views
map function is not display anything
The code is related to singly linked list,I am trying to display a value of a singly linked list using map function and state in react js.
the function logic() is to update state when display button ...
-1
votes
1
answer
433
views
Use map function to validate each input and create border around the input which is invalid or empty on button click
i am working on a form which has multiple steps so in each step when i click next it validate the current active step page with map function.
i want to achieve Use map function to validate each input ...
-1
votes
3
answers
780
views
how to check a condition in object array [closed]
I am trying to use an array map for checking if same username and password exist in an object array
database.map((obj)=>{
if(values.name === obj.name && values.password===obj.password){
...
0
votes
1
answer
56
views
ReactJS map: Expected an assignment or function call and instead saw an expression - no-unused-expressions
I'm in the midst of cleaning up errors for a repo and I've come across this error where someone's trying to to assign a tag value object to a const variable inside of a map function. Here's its ...