diff options
author | 2019-04-12 00:51:04 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:54 +0300 | |
commit | 65997943686cb65caf40218c5f7a0123ccb93935 (patch) | |
tree | 568bf3deabad027d8a0e61028825e597c40d6819 | |
parent | 01b24068a386bffe892bab1a7732fcc3065eeba5 (diff) |
Fix prop-types warnings
-rw-r--r-- | vnext/src/App.js | 10 | ||||
-rw-r--r-- | vnext/src/components/Users.js | 15 |
2 files changed, 12 insertions, 13 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index 687f5225..b3d821e4 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -21,7 +21,7 @@ import cookies from 'react-cookies'; import { me } from './api'; -export default function App(props) { +export default function App() { let params = qs.parse(window.location.search.substring(1)); if (params.hash) { cookies.save('hash', params.hash, { path: '/' }); @@ -81,7 +81,7 @@ export default function App(props) { </div> } <div id="search" className="desktop"> - <SearchBox pathname="/discover" onSearch={search} {...props} /> + <SearchBox pathname="/discover" onSearch={search} /> </div> <nav id="global"> {visitor.uid > 0 ? @@ -127,9 +127,9 @@ export default function App(props) { <Route exact path="/post" render={(props) => <Post visitor={visitor} {...props} />} /> <Route exact path="/pm" render={(props) => <Contacts visitor={visitor} {...props} />} /> <Route exact path="/pm/:user" render={(props) => <Chat connection={es} visitor={visitor} {...props} />} /> - <Route exact path="/:user/friends" render={(props) => <Friends user={props.match.params.user} {...props} />} /> - <Route exact path="/:user/readers" render={(props) => <Readers user={props.match.params.user} {...props} />} /> - <Route exact path="/:user" render={(props) => <Blog key={props.match.params.user} visitor={visitor} {...props} />} /> + <Route exact path="/:user/friends" render={(props) => <Friends visitor={visitor} {...props} />} /> + <Route exact path="/:user/readers" render={(props) => <Readers visitor={visitor} {...props} />} /> + <Route exact path="/:user" render={(props) => <Blog visitor={visitor} {...props} />} /> <Route exact path="/tag/:tag" render={(props) => <Tag visitor={visitor} {...props} />} /> <Route exact path="/:user/:mid" render={(props) => <Thread connection={es} visitor={visitor} {...props} />} /> </Switch> diff --git a/vnext/src/components/Users.js b/vnext/src/components/Users.js index ea3784b9..a10bba7f 100644 --- a/vnext/src/components/Users.js +++ b/vnext/src/components/Users.js @@ -1,17 +1,16 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; +import ReactRouterPropTypes from 'react-router-prop-types'; - -import { UserType } from './Types'; import UserInfo from './UserInfo'; import Avatar from './Avatar'; -export function Friends({ user, ...rest }) { - return <Users user={user} prop='read' />; +export function Friends({ match }) { + return <Users user={match.params.user} prop='read' />; } -export function Readers({ user, ...rest }) { - return <Users user={user} prop='readers' />; +export function Readers({ match }) { + return <Users user={match.params.user} prop='readers' />; } function Users(props) { @@ -32,11 +31,11 @@ function Users(props) { Friends.propTypes = { - user: PropTypes.string.isRequired + match: ReactRouterPropTypes.match.isRequired }; Readers.propTypes = { - user: PropTypes.string.isRequired + match: ReactRouterPropTypes.match.isRequired }; Users.propTypes = { |