localStorage has a size limit of 5MB for most modern browsers unless the user increases it. So, it has a limitation regarding the size limit.
There is a better storage in the browser which is IndexedDB. It's suitable for storing larger amounts of structured data.
It can store both objects and key-value pairs, so it saves time converting objects to strings that are needed when using localStorage.
Its maximum size limit is also larger than localStorage
There is a library called localForage which will automatically use localStorage in browsers with no IndexedDB or WebSQL support.