我在本教程的最后https://www.freecodecamp.org/news/how-to-deploy-a-react-app-with-an-express-server-on-heroku-32244fe5a250/我已將我的 App.js 更改為以下內(nèi)容:import React, { Component } from "react";import "./App.css";class App extends Component { render() { return ( <div> <p>lmfao</p> </div> ); }}export default App;現(xiàn)在不幸的是,在運行“ npm run dev ”后訪問 localhost:5000 時,雖然頁面標題顯示為“React App”并且頁面源是 index.html,但未呈現(xiàn) App 組件并且任何地方都沒有錯誤。這是訪問 localhost:5000 的圖片,它給出了 index.html現(xiàn)在有趣的是,如果我訪問 localhost:3000 上的 React 服務器,組件會渲染。我錯過了什么?非常感謝
通過 Express 服務時,Index.html 不呈現(xiàn)組件
躍然一笑
2021-11-18 15:48:26