Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creat-react-app build not accepting styles

I am moving my react app from self managed webpack build to a create-react-app based one. My styles are not compiling correctly, for example, in my main render method:

      return (
        <Grid>
            <Row style={headerStyle}>
                <Col xs={12}>
                <h1 style={{'text-align': 'center', 'color': 'white'}}>
                    Dashboard v0.3 
                </h1>
                </Col>
            </Row>
       </Grid>
       )

I get the error Warning: Unsupported style property text-align. Did you mean textAlign?. There are a bunch of errors like this. Any help would be appreciated.

like image 877
chris Avatar asked Mar 29 '26 17:03

chris


1 Answers

You are using the wrong syntax. It should be like this:

<h1 style={{textAlign: 'center'}} >
like image 90
Cristian S. Avatar answered Mar 31 '26 07:03

Cristian S.