React-router相关

当使用react-router-dom时
由於在v6版本後做了一些改变
本来在import {HashRouter,Switch,Route} from 'react-router-dom';
switch会失效
出现Attempted import error: 'Switch' is not exported from 'react-router-dom'的报错

引入方面为
from:

import { HashRouter,Switch, Route } from "react-router-dom";

to:

import { Routes ,Route } from 'react-router-dom';

并且在Route标签内的component={页面连结}也做了修改
标签方面改为
from:

<Route path="/"  exact component={Home} />

to:

<Route path='/welcome' element={<Home/>} />

<<:  HTML笔记(01)-前端、後端和全端

>>:  2021-11-24 盘势分析

从零开始的8-bit迷宫探险【Level 29】让你的 App 与众不同!设计 Icon 及 LaunchScreen

回到村子後,山姆变成了斜杠青年,他将探险的故事写成了一本书。 书的封面印着山姆的肖像。 而书名就叫...

Day 2 这些角落生物你可曾了解他

在service planner team规划设计产品服务时,亦负责拟定规划官网及app等四种隐私相...

[Day19] - Django-REST-Framework Viewsets 介绍

在第一个 API 中我们编写的 View,不知道大家有没有觉得非常简洁呢,好像没有写什麽代码,但是就...

Day [28] Azure 认知服务-Custom Vision 建置

Build a classifier with the Custom Vision website ...

Day 16 分享一下研究 Compose UI 到目前的心得

今年的疫情蛮严重的,希望大家都过得安好,希望疫情快点过去, 能回到一些线下技术聚会的时光~ 祝福大家...