Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

46
Views
Material-ui (@Mui) Theming how does it work behind the scenes passing functions to theme?

under this link: https://mui.com/styles/advanced/#theme-nesting I found a guide to customize theming... I was just wondering about that code part:

 <ThemeProvider
          theme={(outerTheme) => ({
            ...outerTheme,
            border: "2px solid black"
          })}
        >

Where you basically pass a function callback to the theme property, that returns an object (with the old ...outertheme props passed to the function and getting destructured and extended..)

I was wondering how was that construct called again and how does it work behind the scenes? I think there was somethign similar in React called render props, where you pass a function to a component property that returns a JSX Expression, but that function gets passed some property from the parent component, that gets that function passed as a child and executes the function but passes additional parameters beforehand to the function as the render props. Is that right?

<Component someThing={property => (<p>This is some {property}</p>)} />

and in Component:

({someThing}) => (...create `property`, return (someThing(property)))
7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.