INNER CODE UNIT · JavaScript

ThemedApp

open-source-labs/Swell · src/index.js:63

function ThemedApp() {
  // Access the isDark state from the Redux store
  const isDark = useSelector((state) => state.ui.isDark);

  // Determine the theme based on the isDark state
  const theme = isDark ? darkTheme : lightTheme;

  return (
    <ThemeProvider theme={theme}>
      <CssBaseline />
      <App />
    </ThemeProvider>
  );
}

/**
 * TODO: Find a way to parse nonce and add it to the MUI cache so 'unsafe-inline' can also be removed
 * TODO: Randomly generate nonce on app launch (within index.js?)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…