packages/material-ui-styles/src/ThemeProvider/ThemeProvider.js
function mergeOuterLocalTheme(outerTheme, localTheme) {
  if (typeof localTheme === 'function') {
    const mergedTheme = localTheme(outerTheme);

    warning(
      mergedTheme,
      [
        'Material-UI: you should return an object from your theme function, i.e.',
        '<ThemeProvider theme={() => ({})} />',
      ].join('\n'),
    );

    return mergedTheme;
  }

  return { ...outerTheme, ...localTheme };
}
function mergeOuterLocalTheme(outerTheme, localTheme) {
  if (typeof localTheme === 'function') {
    const mergedTheme = localTheme(outerTheme);

    warning(
      mergedTheme,
      [
        'Material-UI: you should return an object from your theme function, i.e.',
        '<ThemeProvider theme={() => ({})} />',
      ].join('\n'),
    );

    return mergedTheme;
  }

  return { ...outerTheme, ...localTheme };
}
function mergeOuterLocalTheme ( outerTheme , localTheme ) { if ( typeof localTheme === 'function' ) { const mergedTheme = localTheme ( outerTheme ) ; warning ( mergedTheme , [ 'Material-UI: you should return an object from your theme function, i.e.' , '<ThemeProvider theme={() => ({})} />' , ] . join ( '\n' ) , ) ; return mergedTheme ; } return { ... outerTheme , ... localTheme } ; }
To support composition of theme.
To support composition of theme .