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

Doesnt retain the darkmode when refreshed #44

Open
Jellyyjelly opened this issue Sep 5, 2023 · 0 comments
Open

Doesnt retain the darkmode when refreshed #44

Jellyyjelly opened this issue Sep 5, 2023 · 0 comments

Comments

@Jellyyjelly
Copy link

Jellyyjelly commented Sep 5, 2023

I am completely new to coding, and I can't seem to use the typescript and thus I am using the example.9913d620.js from https://react-toggle-dark-mode.netlify.app/

Is there a way to stop it from going back to light mode after refreshing the page?

I am also looking if I can instead assign its state according to the value of a checkbox because I cant seem to use this if I change the div id="root" into an input type="checkbox" id="root" ( and of course changing the code I have to darkmode to document.getElementById("root").checked )

I am using it like this:

<label tabindex="0" for="mode" >
	<input id="mode" type="checkbox">
	<div id="root">
	</div>
</label>

where my website switches to darkmode when I click the icon as it animates into a moon, and checks the checkbox id="mode". However, when i refresh the page, it stays in darkmode, but the icon goes back to a sun. If you also check the https://react-toggle-dark-mode.netlify.app/ if you turn it into dark mode and then refresh the page, it goes back to light mode.

I want it to retain, how can I do it?

Thank you so much in advance

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