well 16.8 (which basically was the latest version)
also btw: https://reactjs.org/docs/hooks-faq.html#do-i-need-to-rewrite...
and I still have no idea how I only do stuff on the client in a SSR environment (stuff that i did in componentDidMount)
also btw: https://reactjs.org/docs/hooks-faq.html#do-i-need-to-rewrite...
and I still have no idea how I only do stuff on the client in a SSR environment (stuff that i did in componentDidMount)
The 'useEffect' hook - it won't be executed if you use e.g. ReactDOMServer.renderToString() for SSR
useEffect(() => {
console.log('Client side only');
}, []);
Codesandbox: https://codesandbox.io/s/peaceful-dew-nvw83A better example (from the video "React Today and Tomorrow and 90% Cleaner React With Hooks" from October[1]) is something along the lines of updating document.title = `${some} Page` or possibly calling an API.
I think it's clear from the parent I was responding to that they have better use-cases in mind :)