我刚开始做网页开发。当我试着执行npm start命令时,我在localhost/home上没有输出。我想它在App.js文件上,我只是现在不明白。请帮助我的网页开发之神朋友们。
import logo from './logo.svg'
import './App.css';
import Navbar from './components/Navbar';
import React from 'react'
import {BrowserRouter, Route , Link, Routes} from 'react-router-dom';
import Homescreen from './screens/Homescreen';
function App() {
return (
<div className="App">
<Navbar/>
<BrowserRouter>
<Routes>
<Route path ="/home" exact component={Homescreen}></Route>
</Routes>
</BrowserRouter>
</div>
);
}
export default App;
import React from 'react'
function Homescreen() {
return (
<div>
<h1>Home screen</h1>
</div>
)
}
export default Homescreen
1条答案
按热度按时间rqqzpn5f1#
您错误地在path(path ="/home”)前添加了空格