From ccceb785b70eece5a8a9c7a34b44ce59eb159f21 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 12 Oct 2020 01:23:41 +0300 Subject: react-cookies -> react-cookie + universal-cookie --- vnext/src/App.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vnext/src/App.js') diff --git a/vnext/src/App.js b/vnext/src/App.js index 765697ab..ccdae78e 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -16,7 +16,7 @@ import Post from './ui/Post'; import Thread from './ui/Thread'; import Login from './ui/Login'; -import cookie from 'react-cookies'; +import { useCookies } from 'react-cookie'; import { me } from './api'; @@ -27,12 +27,13 @@ const elClassTop = 'content--top'; export default function App() { let contentRef = useRef(null); + const [cookie, setCookie] = useCookies(['hash']); useEffect(() => { svg4everybody(); let params = qs.parse(window.location.search.substring(1)); if (params.hash) { - cookie.save('hash', params.hash, { path: '/' }); + setCookie('hash', params.hash, { path: '/' }); let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`; window.history.replaceState({}, document.title, retpath); } @@ -96,7 +97,7 @@ export default function App() { }; }); }, [x, y, setScrollState]); - const [hash, setHash] = useState(cookie.load('hash')); + const [hash, setHash] = useState(cookie.hash); const [eventSource, setEventSource] = /** @param EventSource? */ useState({}); -- cgit v1.2.3