Skip to content

persisting selected theme to localStorage #35

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1337-ishaan
Copy link

FIxed #19 issue

@vercel
Copy link

vercel bot commented Jun 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/resir014/react-redux-typescript-example/HzuoBNPYdxopqoMZbL86MYpNrhVS
✅ Preview: https://react-redux-typescript-example-git-fork-1337-is-33cf55-resir014.vercel.app

@1337-ishaan
Copy link
Author

@resir014 Pls look into this.

Copy link
Owner

@resir014 resir014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1337-ishaan Sorry, I just got time to look into this. I got some comments for you to look into.

Also, please remove the package-lock.json file.

@@ -14,5 +14,5 @@ export enum LayoutActionTypes {
// Declare state types with `readonly` modifier to get compile time immutability.
// https://github.com/piotrwitek/react-redux-typescript-guide#state-with-type-level-immutability
export interface LayoutState {
readonly theme: ThemeColors
theme: ThemeColors
Copy link
Owner

@resir014 resir014 Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theme: ThemeColors
theme: ThemeColors

@@ -32,7 +32,7 @@ const LayoutContainer: React.FC<LayoutContainerRenderProps> = ({ render, childre

// Create the `setTheme` handler. We use the `dispatch` we got from `useDispatch()` to create said selector.
const setTheme = (color: ThemeColors) => dispatch(layoutActions.setTheme(color))

console.log(localStorage.getItem('theme'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(localStorage.getItem('theme'))

Please remove console.log calls.

@@ -22,7 +22,7 @@ export default function configureStore(history: History, initialState: Applicati
// we'll be passing from our entry point.
const store = createStore(
createRootReducer(history),
initialState,
// initialState,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

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.

Persist Selected Theme To window.localStorage
2 participants