A may have only one child element

路由配置问题

A may have only one child element_第1张图片

 

代码如下:

import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter as Router, Redirect, Route } from 'react-router-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(
    
        
        
    ,
    document.getElementById('root'));
registerServiceWorker();

 

这里提示Router中只能有一个Route配置,删掉一个就可以了

如果想要配置多路由,用一个div把这两个Route包起来就好了,报错已经写得很清楚了

finished....

 

你可能感兴趣的:(react)