我是反应初学者。我正在尝试设置路由器和渲染来更改页面,但它给了我我无法理解的错误。
我已经安装到npm install react-router-dom
我的终端index.js我已经导入BrowserRouter并嵌入了我的应用程序
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import {BrowserRouter} from "react-router-dom"
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
Run Code Online (Sandbox Code Playgroud)
在我的文件中,app.js我有从 导入路由开关react-router-dom。
import Home from './page/home';
import Authentication from "./page/authentication";
import Header from './componenti/header';
import './App.css';
import DashboardComponent from './page/dashboardComponent';
import {Route, Switch} from "react-router-dom"
function App(props) {
return (
<div>
<Header/>
<Switch>
<Route …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建使用 React Native Expo 开发的应用程序,但 Expo Doctor 返回错误:
Expected package expo-modules-autolinking@~1.0.0
Found invalid:
expo-modules-autolinking@0.8.1
(for more info, run: npm why expo-modules-autolinking)
Expected package @expo/config-plugins@^5.0.2
Found invalid:
@expo/config-plugins@4.1.5
@expo/config-plugins@4.1.5
@expo/config-plugins@2.0.4
@expo/config-plugins@5.0.1
@expo/config-plugins@4.1.5
@expo/config-plugins@4.1.5
@expo/config-plugins@4.1.5
(for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@^5.0.5
Found invalid:
@expo/prebuild-config@5.0.3
@expo/prebuild-config@4.0.4
(for more info, run: npm why @expo/prebuild-config)Run Code Online (Sandbox Code Playgroud)
我找到了很多解决方案,但没有一个能解决我的问题。
不幸的是我找不到解决方案