Created
March 6, 2022 07:55
-
-
Save mohsentaleb/e2517cd89e68cc42be27f54e0540f308 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 type { Store } from "./context/reducer"; | |
| import type { Action } from "./context/actions"; | |
| function App() { | |
| const [state, dispatch] = useReducer<React.Reducer<Store, Action>>( | |
| reducer, | |
| initialState | |
| ); | |
| return ( | |
| <AppContext.Provider value={{ state, dispatch }}> | |
| <div className="rect" style={{ backgroundColor: state.background }}> | |
| <span>{state.content}</span> | |
| </div> | |
| <BackgroundControl /> | |
| <ContentControl /> | |
| </AppContext.Provider> | |
| ); | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment