标签:ble 解决 render erro div 原因 route outer body
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>html template</title> </head> <body> <div id=‘root‘></div> </body> </html>
index.js
import React, {Component} from ‘react‘; import { BrowserRouter, Route } from ‘react-router-dom‘; import ReactDom from ‘react-dom‘; import Home from ‘./home‘; import List from ‘./list‘; class App extends Component{ render() { return ( <BrowserRouter> <div> <Route path=‘/‘ exact component={Home} /> <Route path=‘/list‘ component={List} /> </div> </BrowserRouter> ) } } ReactDom.render(<App/>, document.getElementById(‘root‘));
home.js
import React, {Component} from ‘react‘; class Home extends Component{ render() { return ( <div>home</div> ) } } export default Home;
list.js
import React, {Component} from ‘react‘; class List extends Component{ render() { return ( <div>list</div> ) } } export default List;
module.exports = { devServer: { historyApiFallback: true } };
historyApiFallback: { rewrites: [ { from: /abc.html/, to: ‘/index.html‘ }, ] },
标签:ble 解决 render erro div 原因 route outer body
原文地址:https://www.cnblogs.com/wzndkj/p/10885417.html