Answers for "for loop in react native"

0

react native jsx loop with number

Count wiil be my number value = 10;



const {Count} = props;
    let list =  Count=== undefined?10:Count;
    let jsx = [];
    for (let index = 0; index < list; index++) {
        jsx.push('index'+index)
    }

  return (
        <View>
            <Text>{jsx.length}</Text>
        {jsx.map(()=>(
        <Text>{index}</Text>
         ))
        }
        </View>

    )
    
==========================
  
  
if you try like this 
jsx = new Array(list);

this will create array but jsx is not working

try your self
Posted by: Guest on May-24-2021
-1

loop with react and react native

import React from 'react';
import './App.css';


let items=['Item 1','Item 2','Item 3','Item 4','Item 5'];
let itemList=[];
items.forEach((item,index)=>{
  itemList.push( <li key={index}>{item}</li>)
})
function App() {
  
  return (
    <>
   
      <h2>This is a simple list of items</h2>
      <ul>
        {itemList}
      </ul>
    </>
  );
}

export default App;
Posted by: Guest on May-29-2021
0

for loop in react native

buttonsListArr = initialArr.map(buttonInfo => (
  <Button ... key={buttonInfo[0]}>{buttonInfo[1]}</Button>
);
Posted by: Guest on August-24-2021
-1

react native loop in render

{
  countryCodes.map(
    ({name,code,emoji}): React.ReactElement<any> => {
    return (
    <Picker.Item label={emoji+' '+name} value={code} key={name} />
    );
},
  )
}

use this in jsx anywhere use want to use
Posted by: Guest on June-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language