Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f34261

Browse files
author
ziyi.hzy
committed
update router
1 parent2d693b2 commit2f34261

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

‎index.tsx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import * as ReactDOM from "react-dom";
44
import{BrowserRouterasRouter}from"react-router-dom";
55

66
importLayoutfrom"./layout/layout.component";
7-
importstorefrom"./stores/index";
7+
importStorefrom"./stores/index";
88

99
ReactDOM.render(
10-
<Provider{...store}>
11-
<Layout/>
10+
<Provider{...Store}>
11+
<Router>
12+
<Layout/>
13+
</Router>
1214
</Provider>,
1315
document.getElementById("react-dom"),
1416
);
17+

‎layout/layout.component.tsx‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ export default class Layout extends React.PureComponent<Props, State> {
1212

1313
publicrender(){
1414
return(
15-
<Router>
15+
<div>
1616
<div>
17-
<div>
18-
<Linkto="/">首页</Link>
19-
<Linkto="/count">Count</Link>
20-
</div>
21-
22-
<Switch>
23-
<Routeexactpath="/"component={Home}/>
24-
<Routeexactpath="/count"component={Count}/>
25-
</Switch>
17+
<Linkto="/">首页</Link>
18+
<Linkto="/count">Count</Link>
2619
</div>
27-
</Router>
20+
21+
<Switch>
22+
<Routeexactpath="/"component={Home}/>
23+
<Routeexactpath="/count"component={Count}/>
24+
</Switch>
25+
</div>
2826
);
2927
}
3028
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp