How to set maxWidth of Container to 100% >> Globally

Viewed 2080

Whenever I use a container in material-ui, I have to manually set the maxWidth to false. Since I don't think I will ever require the maxWidth of the container to every be anything but 100% of the available space and it is what I expect container to work, I wanted to set it globally in my react app.

What I have to do every time

import React from "react";
import Container from "@material-ui/core/Container";
import Paper from "@material-ui/core/Paper";

export default function App() {
  return (
    <Container maxWidth={false}>
    .
    .
    .
    </Container>
  );
}

I tried setting it in the createTheme, but it does not work.

const theme = createMuiTheme({
      overrides: {
        MuiContainer: {
          root: {
            maxWidth: `100%`,
          },
        },
      },
    });
1 Answers
Related