2

Typically when I use Radium in my React app, I would simply wrap my exported class inside Radium

export default Radium(App)

and media queries would work as expected. However, I want to use both connect from react-router alongside Radium like this:

//Imports
import React from 'react'
import Radium from 'radium'
import { Table, TableBody } from 'material-ui/Table'
import { connect } from 'react-redux

const tableWrapper = {
    width: '100%',
    '@media screen and (max-width: 799px)': {
        width: '50%'
    }
}

render() {
    <Table wrapperStyle={tableWrapper}>
        <TableBody>
           ...
        </TableBody>            
    </Table>
}

function mapDispatchToProps(dispatch) {
    return bindActionCreators(Object.assign({}, {update}), dispatch)
}

export default connect(null, mapDispatchToProps)(Radium(App))
export { App as AppNoRadium }

but I continue to receive the warning/error when I apply my styles:

Warning: Unsupported style property @media screen and (max-width: 799px). Did you mean @media screen and (maxWidth: 799px)?

Am I incorrectly wrapping my component inside Radium?

patrickhuang94
  • 2,085
  • 5
  • 36
  • 58

1 Answers1

-1

Why are you exporting file again in the end . Use following

Login = connect(mapStateToProps, { })(Radium(Login)); export default Login;

This will work fine. Don't forget to import radium on top :)

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93