React腳手架下入口文件index.html的解釋說明
<head> <meta charset="utf-8" /> <!--%PUBLIC_URL% 代表 public的路徑 react中的一個(gè)關(guān)鍵詞 --> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <!-- 開啟理想視口, 用于做移動(dòng)端網(wǎng)頁的適配 即視口與設(shè)備物理像素一致 --> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- 用于配置瀏覽器頁簽 + 地址欄的顏色(僅支持安卓手機(jī)瀏覽器, 開發(fā)時(shí)很少用,因?yàn)榧嫒菪圆? --> <meta name="theme-color" content="#000000" /> <meta name="description" content="Web site created using create-react-app" /> <!-- 用于指定網(wǎng)頁添加到手機(jī)主屏幕后的圖標(biāo)(頁面的快捷鏈接) 僅支持蘋果 --> <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> <!-- 應(yīng)用加殼時(shí)的配置文件 html + 加殼 == 生成一個(gè) 安裝或IOS的app應(yīng)用 --> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <title>React App</title> </head> <body> <!-- 如果 瀏覽器不支持JS,則顯示標(biāo)簽中的內(nèi)容,當(dāng)然,現(xiàn)在的瀏覽器都支持, 所以這段代碼其實(shí)不寫也沒關(guān)系,只是React老虎的更加全面了, 照顧了老掉牙 --> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> <!-- react 容器 --> <!-- 后續(xù)的App.js組件會(huì)放到id = root 的容器中, 且我們自己定義的組件放到App容器中--> </body>