Use inline style in React
Question:
How to use inline style in React? Answer:
<div style={{left:20; borderTop:'2px solid red'}}>
<div style={{left: this.state.left}}>
Description:
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.
Reference:
React style attrubute
Share "How to use inline style in React?"
Related snippets:
Tags:
react inline style, inline style, react style object Technical term:
Use inline style in React