material-dashboard-react icon indicating copy to clipboard operation
material-dashboard-react copied to clipboard

Save theme values

Open vberick opened this issue 1 year ago • 1 comments

Hi! I need help saving theme values using local storage method, when you pick dark mode and reload you get the default value how can I storage that value and retrieve it after reload ! Thanks in advance

vberick avatar Oct 18 '23 04:10 vberick

You really should be using an api with some kind database to achieve this. The values can be saved in localstorage on the browser or even in cookies, but you probably know that this is not a good solution because it will only work for that browser. These templates are not for production use, they are only demos of the template.

You can use localStorage as in this article: https://www.freecodecamp.org/news/how-to-use-localstorage-with-react-hooks-to-set-and-get-items/

The values for the darkmode in the state for the gear settings component,

Hope this answers your question.

waywardcode avatar Nov 05 '23 21:11 waywardcode