About the withTheme function in materialUI?

when I check the official DEMO of material-UI, I see a function description about the theme, which is not very clear. The function he defines is as follows:

withTheme()(Component) => Component
theme



Component:


Component:



import { withTheme } from "material-ui/styles"

export default withTheme()(MyComponent);

what is the use of the first parenthesis after withTheme? His final definition of the arrow function will return a component, why the example is directly withTheme () (MyComponent) and omitted the arrow function part? Is there a return component written in this way?

Mar.02,2021

has resolved the problem. 1.withTheme () () is actually a nested function that generates a function using withTheme () for the first time and a MyComponent component using withTheme () (MyComponent) again.
2.withTheme () (MyComponent) is just a definition, and the arrow after it indicates that the resulting return value is a component component, not an arrow function.

Menu