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

Save to localstorage #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

youminkim
Copy link

People can save and revise their goals easily. Utilized localStorage.

Screen.Recording.2022-08-28.at.5.00.31.PM.mov

Copy link
Owner

@ddongule ddongule left a 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! 🤩

Comment on lines +55 to +73
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('초기화 되었습니다.');
};
Copy link
Owner

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('초기화 되었습니다.')
    }
  }

Comment on lines -50 to +55
/>
></span>
Copy link
Owner

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?

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

Successfully merging this pull request may close these issues.

2 participants