Skip to content
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

Model -> localStorage Json.parse() #14

Open
amorfati0310 opened this issue Sep 19, 2018 · 0 comments
Open

Model -> localStorage Json.parse() #14

amorfati0310 opened this issue Sep 19, 2018 · 0 comments

Comments

@amorfati0310
Copy link
Owner

Model 로 생성자를 톡해서 만들어진 객체
todoModel 객체가 localStorage로 저장되었다가 다시 나올 때는 todoModel

var a = [...$r.props.todos]
undefined
a
(4) [TodoModel, TodoModel, TodoModel, TodoModel]

 당시에는 parse를 하고 있는데 
var b = JSON.parse(localStorage['LOCAL_TODO'])
undefined
b 기존 생성자와 연결된 prototype을 기억하고 있지 못한다. 
(4) [{}, {}, {}, {}]

https://stackoverflow.com/questions/8779249/how-to-stringify-inherited-objects-to-json
https://stackoverflow.com/questions/12369543/why-is-json-stringify-not-serializing-prototype-values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant