Search code examples
reactjsreact-reduxmaterial-uireact-component

How to integrate constants and functions in React Component class?


Let's take the AppBar code from Material-UI: https://material-ui.com/components/app-bar/#app-bar-with-a-primary-search-field

There is a "renderMobileMenu". I want to integrate it. The problem is that the sample code uses "function" whereas mine is a React Component class. I need guidance on how to integrate that renderMobileMenu (and relevant) piece of code in a React Component class. I am also using React Redux.

export default connect(
    mapStateToProps,
    {wbToggle: wbToggle, vidToggle: vidToggle, fileToggle: fileToggle}
)(Utilitybar);

I have tried but it always gives error that I am breaking laws of hooks.


Solution

  • you can check the v3 docs to see how it's used in the old fashioned way.

    https://v3.material-ui.com/demos/app-bar/#app-bar