Last active
March 6, 2022 07:02
-
-
Save mohsentaleb/312b4671b4afbd13e25ff7d2f5fe7a34 to your computer and use it in GitHub Desktop.
Anatomy of the app
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
function App() { | |
// initialState = { background: "#ccc", content: "Hello World!"} | |
const [state, dispatch] = useReducer(reducer, initialState); | |
return ( | |
<AppContext.Provider value={{ state, dispatch }}> | |
<div className="rect" style={{ backgroundColor: state.background }}> | |
<span>{state.content}</span> | |
</div> | |
<BackgroundControl /> | |
<ContentControl /> | |
</AppContext.Provider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment