I'm trying to find the folder location of local storage when using react. Is the location specific to the browser or specific to react?
Asked
Active
Viewed 1,519 times
2
-
Who says it's in a folder at all? Why do you care where it is? What problem are you trying to solve? – Matt Ball Nov 15 '17 at 23:53
-
The location should be specific to the OS, then browser, then domain. What are you trying to do? It's probably not visible or human-readable. – DiegoRBaquero Nov 15 '17 at 23:54
-
just curious, I like to know where things are – DCR Nov 15 '17 at 23:58
-
In short, it's in the same folder as your browser (or in a sub-folder of that folder). The longer answer is that the exact location varies based on the browser, and probably also operating system, so there's no good way to know. It really doesn't matter though, given that you have absolutely no control over it (unless you have write permissions on your user's computer, in which case web tech isn't even applicable). – machineghost Nov 16 '17 at 00:31
-
local storage is protected, and not something you are meant to access in any other way than through your app. The physical method of storage isn't something you can control, manipulate, or access. – Claies Nov 16 '17 at 00:32
-
Downvoters: why? This is a perfectly legitimate question that betrays the author's misunderstanding of how local storage works. The answer (that it doesn't work the way the OP thinks) can likely be valuable to other novices. Please don't downvote legitimate questions, no matter how n00b-ish they might be. – machineghost Nov 16 '17 at 00:35
-
1@Claies If it's on-disk you can access it (your own, I mean), but the hoops you'd potentially have to jump through may make it impractical. OP just wants to know where it is- it's curiosity, a good thing. – Dave Newton Nov 16 '17 at 00:36
-
@machineghost I don't think there's necessarily a misunderstanding-just asking where local storage lives. It lives *somewhere*. Whether it's practical to *do* anything with it is orthogonal. – Dave Newton Nov 16 '17 at 00:38
-
@DaveNewton " Is the location specific to the browser or specific to react?" clearly betrays a lack of understanding. Also, implicit in the idea that knowledge is worth acquiring is the idea that you can do something with it, and there's really nothing you can do with the location of local storage data on a user's computer. But my point wasn't to argue over the OP's understanding, my point was to discourage downvoting of a legitimate question. – machineghost Nov 16 '17 at 00:40
1 Answers
1
If you're just trying to get access to localStorage in React, you can just call window.localStorage.[methodName]()
to get / set / remove just like in vanilla js.
There should be no difference whether you're using Vanilla JS, React or any other framework. LocalStorage exists on the window
, that is to say, its global in the browser, so as long as your app is running in a browser that supports localStorage, then you can get to it via window
.

ahutch
- 154
- 1
- 5
-
1OP is asking for the physical location, which is an implementation detail. – Dave Newton Nov 16 '17 at 00:31