Skip to content

Instantly share code, notes, and snippets.

@mohsentaleb
Created March 6, 2022 07:55
Show Gist options
  • Select an option

  • Save mohsentaleb/e2517cd89e68cc42be27f54e0540f308 to your computer and use it in GitHub Desktop.

Select an option

Save mohsentaleb/e2517cd89e68cc42be27f54e0540f308 to your computer and use it in GitHub Desktop.
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