-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I use persist-js on react #40
Comments
Did you manage to find a solution for this? Thanks! |
I don't remember this error. const data = {}; class StorageUtilities { // get // remove const storageUtilities = new StorageUtilities(); export default storageUtilities; |
Not working for me , what is this persist-js that you imported ? The minified ? Whenever I try to do this import there is this error: Line 31: 'google' is not defined no-undef |
I got it working with the following: Import local copy of persist.jsimport "./PATH/TO/persist.js" // Not the min one
var store = new window.Persist.Store('My Application') // accessing store example usage var store = new window.Persist.Store('My Application') // accessing store
store.set('key', 'value)
console.log(store.get('key')) Ignore no-undef by specifying globalsThe following error could be ignored.
Adding specifying globals in persist.js by adding the following to line 1. /* global google GearsFactory ActiveXObject global storage swfobject Persist*/ For more info read this Fix syntax error (optional)and fix error in line 1097 // get domain (XXX: does this localdomain fix work?)
o.domain = o.domain || 'localhost'; Tested on Safari, had to replace localStorage as it didn't work for Safari. |
Your solution confused me:
|
|
I am importing persist.js, not min. It doesn't work. |
@jwhitty1 here is an example https://codesandbox.io/s/persist-react-example-udheu Your question - Can you say exactly where and how that should be written, My answer - read the docs on eslint.
https://eslint.org/docs/2.0.0/user-guide/configuring#specifying-globals Your question - Could you more-closely-read my questions. My answer - could you please ask questions with more information, what errors, what did you do exactly etc. |
Hello I'm trying to use persist-js on my React preject but I'm getting this error:
Line 6: 'Persist' is not defined no-undef
Search for the keywords to learn more about each error.
The problem is that I don't know how to import the lib correctly
I have tried this:
import 'persist-js' and
import Persist from 'persist-js'
With no luck.
Some workaround?
The text was updated successfully, but these errors were encountered: