Currently utilizing React, Redux, and experimenting with Material-UI integration. The example codes provided by Redux and Material-UI libraries include an 'export' statement at the end.
Redux:
export default connect(mapStateToProps, actions)(myComponent)
Material-UI:
export default withStyles(styles)(myComponent);
Attempting to combine both exports together, I encountered the need to remove the 'default'. Here's what I thought it should be:
This method does not work:
export {
connect(mapStateToProps, actions)(myComponent),
withStyles(styles)(myComponent)
}
Error:
"Syntax error: Unexpected token, expected , (120:15)
export {connect(mapStateToProps, actions)(myComponent)}
^
Trying this approach didn't yield the desired results: I attempted to assign a name to the function, but for unknown reasons, the function was not called as expected.
import * as myConnect from 'react-redux'
...
export const connect = myConnect.connect(mapStateToProps, actions)(View)
Unsure of the underlying issue causing this problem, I find myself in a standstill. Any assistance would be greatly appreciated :-)
EDIT Although I have yet to find a solution, I managed to work around the issue. I decided to separate the component (myComponent) into its own file. This approach has improved the overall design, now allowing for a clear distinction between pure components and containers.