-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1、客户端用的路由是 BrowserRouter import { BrowserRouter } from "react-router-dom"; 2、服务器端路由是 StaticRouter import { StaticRouter } from "react-router-dom/server";
- Loading branch information
bin.zhang02
committed
Jan 16, 2022
1 parent
63ec354
commit 05db320
Showing
5 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
import { Route, Routes } from "react-router-dom"; | ||
import Home from "./containers/Home/index"; | ||
|
||
export default ( | ||
<div> | ||
<Routes> | ||
<Route path="/" exact element={<Home />} /> | ||
</Routes> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import React from "react"; | ||
import ReactDom from "react-dom"; | ||
import Home from "../containers/Home"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import Routes from "../Routes"; | ||
|
||
ReactDom.hydrate(<Home />, document.getElementById("root")); | ||
const App = () => { | ||
return <BrowserRouter>{Routes}</BrowserRouter>; | ||
}; | ||
|
||
ReactDom.hydrate(<App />, document.getElementById("root")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters