When a React component is created on the server side that uses window or localStorage these browser global variables, I always need to add
if (typeof localStorage !== 'undefined') { // then do stuff }
to get rid of the "localStorage is not defined" errors.
Are there any other worthy solutions?
Change my use case
window for its attributes like innerwitdth and adding raw browser events like resizelocalStorage - store JWT token
source share