diff options
author | Vitaly Takmazov | 2022-10-28 12:48:23 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:58 +0300 |
commit | 13c15825aa6b651439c043c75d9871e52c69cf9f (patch) | |
tree | d09a7540b29aa3fc70be1107170118088916fc45 /vnext/src/ui/Post.js | |
parent | 4039230974bb5275a70797c48f8c4635d253514c (diff) |
Upgrade to `react-router` v6
Diffstat (limited to 'vnext/src/ui/Post.js')
-rw-r--r-- | vnext/src/ui/Post.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vnext/src/ui/Post.js b/vnext/src/ui/Post.js index d8d841e1..a1d14ea0 100644 --- a/vnext/src/ui/Post.js +++ b/vnext/src/ui/Post.js @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { useLocation, useHistory } from 'react-router-dom'; +import { useLocation, useNavigate } from 'react-router-dom'; import qs from 'qs'; @@ -13,7 +13,7 @@ import { post, update } from '../api'; */ export default function Post({ visitor }) { const location = useLocation(); - const history = useHistory(); + const navigate = useNavigate(); let draftMessage = (location.state || {}).draft || {}; let [draft, setDraft] = useState(draftMessage.body); let params = qs.parse(window.location.search.substring(1)); @@ -24,7 +24,7 @@ export default function Post({ visitor }) { .then(response => { if (response.status === 200) { const msg = response.data.newMessage; - history.push(`/${visitor.uname}/${msg.mid}`); + navigate(`/${visitor.uname}/${msg.mid}`); } }).catch(console.log); }; |