Created
February 25, 2022 18:37
-
-
Save bashidagha/3da3a646d1dd6c1336ef15b433aa685f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore } from "redux"; | |
import { Provider } from "react-redux"; | |
import Header from "./Header"; | |
const initialState = { username: "Farshid" }; | |
const returnStateReducer = (state = initialState, action) => { | |
if (action.type === "updateUser") { | |
return { ...state, username: "Farhad" }; | |
} else { | |
return state; | |
} | |
}; | |
const store = createStore(returnStateReducer); | |
const App = () => { | |
return ( | |
<Provider store={store}> | |
<div> | |
<Header /> | |
<h1>Hello World</h1> | |
</div> | |
</Provider> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment