docs: function ThemeProvider(props) {
    const { children, theme: localTheme } = props;
    const outerTheme = useTheme();
  
    warning(
      outerTheme !== null || typeof localTheme !== 'function',
      [
        'Material-UI: you are providing a theme function property ' +
          'to the ThemeProvider component:',
        '<ThemeProvider theme={outerTheme => outerTheme} />',
        '',
        'However, no outer theme is present.',
        'Make sure a theme is already injected higher in the React tree ' +
          'or provide a theme object.',
      ].join('\n'),
    );
  
    const theme = React.useMemo(() => {
      const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
  
      if (outerTheme !== null && output) {
        output[nested] = true;
      }
  
      return output;
    }, [localTheme, outerTheme]);
  
    return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
  }