檢查代碼,找不到我需要放分號的地方。這是錯誤。這是代碼。
uj5u.com熱心網友回復:
它應該是
const Routes = (props) => (
...
)
uj5u.com熱心網友回復:
應該是這樣的
const Routes = (props) => ( ... )
uj5u.com熱心網友回復:
應該是這樣的
const PropsPage = () => { return ( <h3>Props Page</h3> );};
為一個
const App = () => {
return (
<section className="App">
<Router>
...
<Link to="/404-not-found">404</Link>
<Link to="/props">Passing Props</Link> <Switch>
...
<Route exact path="/props" component={PropsPage} /> <Route component={NoMatchPage} />
</Switch>
</Router>
<a href="/about">about with browser reload</a>
</section>
);
};
在 Route 組件中將函式作為組件 props 傳遞
const PropsPage = ({ title }) => {
return (
<h3>{title}</h3>
);
};
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/377860.html
上一篇:取消axios請求,如果來自服務器的回應在10秒后到來
下一篇:在ReactNative中使用react-navigationv6的身份驗證流程問題。錯誤:無效的掛鉤呼叫。不變違規:“主要”尚未注冊
