From 13c15825aa6b651439c043c75d9871e52c69cf9f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 28 Oct 2022 12:48:23 +0300 Subject: Upgrade to `react-router` v6 --- vnext/src/ui/Post.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vnext/src/ui/Post.js') 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); }; -- cgit v1.2.3