I got this error because, while parsing JSON it is expecting string result. 


So when you try to use localStorage.getItem() you may follow this way,

JSON.parse(localStorage.getItem('currentUser')|| '{}')