當前位置:成語大全網 - 新華字典 - reactnative 怎麽遍歷數組去設值

reactnative 怎麽遍歷數組去設值

html>

<head>

<meta charset="UTF-8">

<title>React遍歷數組</title>

<script type="text/javascript" src="../js/react.js" ></script>

<script type="text/javascript" src="../js/react-dom.js" ></script>

<script type="text/javascript" src="../js/browser.min.js" ></script>

<script type="text/babel">

var students = ["張三然","李慧思","趙思然","孫力氣","錢流量"];

ReactDOM.render(

<ul>

{

students.map(function(username){

return <li>{username}</li>

})

}

</ul>,

document.getElementById("ulLi")

)

</script>

</head>

<body>

<div id="ulLi"></div>

</body>

</html>