Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Created January 16, 2023 19:30
Show Gist options
  • Save SahanAmarsha/cb23fbc34408eacc5764b462bc026139 to your computer and use it in GitHub Desktop.
Save SahanAmarsha/cb23fbc34408eacc5764b462bc026139 to your computer and use it in GitHub Desktop.
Final index.tsx file after adding AuthProvider
import * as React from "react";
import { createRoot } from "react-dom/client";
import CssBaseline from "@mui/material/CssBaseline";
import { ThemeProvider } from "@mui/material/styles";
import App from "./App";
import theme from "./theme";
// import aws amplify
import { Amplify } from "aws-amplify";
import awsExports from "./aws-exports";
import AuthProvider from "./contexts/AuthContext";
const rootElement = document.getElementById("root");
const root = createRoot(rootElement!);
// configure amplify
Amplify.configure(awsExports);
root.render(
<ThemeProvider theme={theme}>
<AuthProvider>
<CssBaseline />
<App />
</AuthProvider>
</ThemeProvider>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment