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

New example raw and hiddenlabel #11

Merged
merged 5 commits into from
Oct 28, 2024

Conversation

lucasferreiralimax
Copy link
Member

This PR introduces local storage persistence for the showRaw and hiddenLabel checkbox states, allowing users to retain their preferences across sessions for a more consistent experience. Upon page reload, the selected checkbox states will now be restored, based on the saved values in local storage.

Changes Implemented:

  1. Checkbox State Initialization:

    • The showRaw and hiddenLabel states are initialized based on stored values in localStorage.
    • Defaults to false if no prior values are found in localStorage.
  2. State Persistence in localStorage:

    • Uses useEffect hooks to save updated showRaw and hiddenLabel states whenever they are toggled, ensuring these values persist in localStorage.
  3. UI Update:

    • Adjusted the checkboxes in the App component to display saved user preferences after page reload.

@lucasferreiralimax lucasferreiralimax self-assigned this Oct 28, 2024
@lucasferreiralimax lucasferreiralimax linked an issue Oct 28, 2024 that may be closed by this pull request
@lucasferreiralimax lucasferreiralimax merged commit e5054e5 into master Oct 28, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persist showRaw and hiddenLabel Checkbox example
1 participant