-
Notifications
You must be signed in to change notification settings - Fork 6
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
Save to localstorage #6
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, youmin! 🧡
I have left some comments for you. Please tell me what you think of my comments!
your thoughts are always welcomed. 🍀
thank you again, about your contribution! 🤩
const handleReset = () => { | ||
setName(''); | ||
setIsModalOpen(false); | ||
|
||
// localstoage | ||
localStorage.setItem('mainInput', JSON.stringify(MAIN)); | ||
localStorage.setItem('subInput', JSON.stringify(SUB)); | ||
|
||
// input values | ||
setMainInput(MAIN); | ||
setSubInput(SUB); | ||
for (var i = 0; i < 9; i++) { | ||
for (var j = 0; j < 9; j++) { | ||
setInputValue(i + 1, j, ''); | ||
} | ||
setInputValue('main', i, ''); | ||
} | ||
alert('초기화 되었습니다.'); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is already great, but what do you think about putting one more hurdle before initialization? 🤩
Just in case that button is pressed against by people's intension.
things like..
const handleReset = () => {
if (window.confirm('초기화 하시겠습니까?') {
setName('')
...
alert('초기화 되었습니다.')
}
}
/> | ||
></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think self-closing tag could be better because there is nothing between them! 😁
how do you think of this?
People can save and revise their goals easily. Utilized localStorage.
Screen.Recording.2022-08-28.at.5.00.31.PM.mov