Feature/update dependency react router dom to v6.x (#340)

* Update dependency "react-router-dom" to v6.x

Update to v6.11.2

* Update dependency "react-router-dom" to v6.x - Replace "Switch" with "Routes"

* Update dependency "react-router-dom" to v6.x - Relative paths

* Update dependency "react-router-dom" to v6.x - Nested routes

* Update dependency "react-router-dom" to v6.x - Prevent route warnings

 - Route without an element causes a warning message.
 - Routes with non-matching Route causes a warning message.

* Update dependency "react-router-dom" to v6.x - Replace "useHistory" with "useNavigate"

* Update dependency "react-router-dom" to v6.x - Fix "Link" usage

* Update dependency "react-router-dom" to v6.x - Overwrite "useParams" and "useLocations" typing

For both functions it's the users fault if they are getting used incorrectly.
It's inconvenient to always have to make sure the params exist (useParam) or to cast the return object to a specific type (useLocation)

 - "useParams": Make generic type non-optional
 - "useLocation": Add generic type

* Update dependency "react-router-dom" to v6.x - Fix use-query-params provider
This commit is contained in:
schroda
2023-06-04 21:30:15 +02:00
committed by GitHub
parent fd5a1e240a
commit 4e8813b526
15 changed files with 114 additions and 224 deletions

View File

@@ -55,10 +55,7 @@ const SourceCard: React.FC<IProps> = (props: IProps) => {
margin: '10px',
}}
>
<CardActionArea
component={Link}
to={{ pathname: `/sources/${id}`, state: { contentType: SourceContentType.POPULAR } }}
>
<CardActionArea component={Link} to={`/sources/${id}`} state={{ contentType: SourceContentType.POPULAR }}>
<CardContent
sx={{
display: 'flex',
@@ -107,10 +104,8 @@ const SourceCard: React.FC<IProps> = (props: IProps) => {
<Button
variant="outlined"
component={Link}
to={{
pathname: `/sources/${id}`,
state: { contentType: SourceContentType.LATEST },
}}
to={`/sources/${id}`}
state={{ contentType: SourceContentType.LATEST }}
>
{t('global.button.latest')}
</Button>
@@ -121,10 +116,8 @@ const SourceCard: React.FC<IProps> = (props: IProps) => {
<Button
variant="outlined"
component={Link}
to={{
pathname: `/sources/${id}`,
state: { contentType: SourceContentType.LATEST },
}}
to={`/sources/${id}`}
state={{ contentType: SourceContentType.LATEST }}
>
{t('global.button.latest')}
</Button>
@@ -132,7 +125,8 @@ const SourceCard: React.FC<IProps> = (props: IProps) => {
<Button
variant="outlined"
component={Link}
to={{ pathname: `/sources/${id}`, state: { contentType: SourceContentType.POPULAR } }}
to={`/sources/${id}`}
state={{ contentType: SourceContentType.POPULAR }}
>
{t('global.button.popular')}
</Button>