Linked Questions
14 questions linked to/from How can I render repeating React elements?
2099
votes
88
answers
2.2m
views
Loop inside React JSX
I'm trying to do something like the following in React JSX (where ObjectRow is a separate component):
<tbody>
for (var i=0; i < numrows; i++) {
<ObjectRow/>
}
</...
1095
votes
32
answers
1.4m
views
Understanding unique keys for array children in React.js
I'm building a React component that accepts a JSON data source and creates a sortable table.
Each of the dynamic data rows has a unique key assigned to it but I'm still getting an error of:
Each ...
323
votes
14
answers
112k
views
Why does the `map` method apparently not work on arrays created via `new Array(count)`?
I've observed this in Firefox-3.5.7/Firebug-1.5.3 and Firefox-3.6.16/Firebug-1.6.2
When I fire up Firebug:
var x = new Array(3)
console.log(x)
// [undefined, undefined, undefined]
var y = [...
195
votes
11
answers
200k
views
How to repeat an element n times using JSX and Lodash
I am using React/JSX and Lodash in my app in order to accomplish what I want.
I need to repeat an element a certain amount of times depending on a condition. How should I do that?
Here is the element:
...
13
votes
4
answers
38k
views
Append a React component in another on button click
I have a big component <User> and a small one <Task> and want to give a big component a button and on click on it append the component <Task> to the <User>
User.jsx
<div&...
15
votes
2
answers
36k
views
Warning: validateDOMNesting(...): <div> cannot appear as a child of <tbody>
I'm creating a table in React (I'm new to React), but the CategoryDataCan we live with those or should we use something else? It is not creating cells correctly, i.e. it's creating cells that are not ...
4
votes
3
answers
24k
views
Iterating through a JSON response in JSX Render for React.js
I'm trying to create a table from a JSON response formulated from a submitted form, therefore the initial render needs to be blank, but this blank state is proving to be an issue.
The issue is ...
14
votes
2
answers
11k
views
How do I include Javascript code in the render function of a react native app? [duplicate]
I'm a React and React native noob so its probably going to be a very silly question but how can I use the 'for loop' inside the render function to include my components? This is what I did
render(...
0
votes
1
answer
5k
views
React Bootstrap Table can't create TableHeaderColumn with map Error. No any key column defined in TableHeaderColumn
I get the following error when I try to create TableHeaderColumn programatically using map.
Uncaught Error: Error. No any key column defined in TableHeaderColumn.
Use 'isKey={true}' to specify a ...
-2
votes
1
answer
3k
views
Add a component to another component on button click
I'm creating a page that if user clicks add more button a text box should be added as many time the user clicks
I have created a component where I've created texbox. I've tried to render this ...
0
votes
2
answers
3k
views
Add fallback src to image on React during server fail (S3)
I have a React + Rails app and the current S3 server issues made me realize that I don't have a proper fallback mechanism when data can't be pulled from s3. I'm trying to make it work with my locally ...
-1
votes
1
answer
188
views
Struggling to render multiple components onto a page using a function + for loop
I want to render components into my React app using a for loop inside of a function.
But when I add n > 1 number of components to the variable I am returning inside of the function, the page ends ...
-2
votes
2
answers
84
views
Is there a way to perform a map on a single digit similar to an array?
const emptyRow = 3;
How can I map on this if it's a number and not an array?
Similar to using map on an array but instead on a number.
something like:
emptyRow.map(el => {
return (
<div>...
0
votes
1
answer
44
views
including jsx in setstate with spread operator
So I was trying to setstate a variable with jsx and spread operator but no matter how I try I get stuck without any output or with errors can anyone please help me how to achieve this??
Here is the ...