0
我有一條路徑沒有渲染。這可能是一個noob問題,但我嘗試了一切。使用最新版本的React,react-route-dom和es6。沒有顯示的反應路線
我App.js:
import React from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import Controller from './Controller'
import Floor from './Floor'
const App =() => {
return (
<div>
<Router>
<Switch>
<Route path="/floor" component={Floor}/>
<Route path="/controller" component={Controller}/>
</Switch>
</Router>
</div>
)
}
export default App
我的組件:
import React, { Component } from 'react';
import ReactDOM from 'react-dom'
export default class Floor extends Component {
render() {
return (
<div>Floor</div>
);
}
}
我檢查:
在瀏覽器中什麼都沒有渲染時,您打開了哪個網址? – trixn