-
Notifications
You must be signed in to change notification settings - Fork 146
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
base: master
Are you sure you want to change the base?
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/resir014/react-redux-typescript-example/HzuoBNPYdxopqoMZbL86MYpNrhVS |
@resir014 Pls look into this. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
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?
FIxed #19 issue