reactjs - how to set inline style in react jsx -
i trying apply inline styles in react component follows. right way set styles, if not how can achieve this?
<div {...customprops} style={{ width: `${widthvalue}%`, animationdelay: `${animationdelay}s`, zindex: `${zindex}`, animation: `loadbar ${incrementvalue}s linear forwards`}} key={i} classname={`well-background--${group.concept} well-groupedprogressbar--progress well-groupedprogressbar--${props.heightsize}`} />,
thanks
you need pass obj inline styles attribute. code correct, can clean code preparing style object in render function if changing everytime like
render() { var style = { width: `${widthvalue}%`, animationdelay: `${animationdelay}s`, zindex: `${zindex}`, animation: `loadbar ${incrementvalue}s linear forwards` } return ( <div {...customprops} style={style} key={i} classname={`well-background--${group.concept} well-groupedprogressbar--progress well-groupedprogressbar--${props.heightsize}` } /> ) }
Comments
Post a Comment