- Instant help with your JavaScript coding problems

Use inline style in React

How to use inline style in React?
<div style={{left:20; borderTop:'2px solid red'}}>

<div style={{left: this.state.left}}>

The style attribute accepts a JavaScript object with camelCased properties rather than a CSS string. React will automatically append a “px” suffix to certain numeric inline style properties. If you want to use units other than “px”, specify the value as a string with the desired unit.



Share "How to use inline style in React?"