1、问题背景
2、实现源码
<!DOCTYPE html> <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 strArray = [ <label>春季</label>,<span>夏季</span>,<p>秋季</p>,<dl>冬季</dl> ]; ReactDOM.render( <ol> { strArray.map(function(username){ return <li>{username}</li> }) } </ol>,document.getElementById("arrDiv") ); </script> </head> <body> <div id="arrDiv"></div> </body> </html>
3、实现结果