Material UI v1 with Redux - How to export

Viewed 4144

I am trying to make use of Material-UI v1 with stajuan's Redux-Saga Login template shown here. So, I want to merge the export default thing of those two, in other words combine two functions for exporting the default class:

import React, {Component} from 'react';
import { connect } from 'react-redux';
import { withStyles, createStyleSheet } from 'material-ui/styles';

// Redux
function select (state) {
    return {
    data: state
    }
}

// Material UI v1
const styleSheet = createStyleSheet(theme => ({
    // ...
}));

// Class to be exported
class Login extends Component {
    // ...
    render () {
        // ...
    }

}

// H O W   T O   M E R G E   T H O S E ? ? ?
// export default connect(select)(Login);
// export default withStyles(styleSheet)(Login);

The last two commented-out lines of the code above are the statements to be combined in my case.

2 Answers

You will be able to access with the key

this.props.domain

Add below line to export your class

const mapStateToProps = state => {
    return { domain : 'yourdomain.com'
    }
}
export default withStyles(styles)(connect(mapStateToProps)(Login));
Related