aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/App.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-10-12 01:23:41 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitccceb785b70eece5a8a9c7a34b44ce59eb159f21 (patch)
tree0b32c4ebe0a91bc967e8b91eba919962de5e3823 /vnext/src/App.js
parent884c5ca43f80dae6bcd5bd294d3e566dec87eb24 (diff)
react-cookies -> react-cookie + universal-cookie
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r--vnext/src/App.js7
1 files changed, 4 insertions, 3 deletions
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({});