javascript - Extending style object in react.js -


i'm using react.js , manage of style attributes via react, too. if have a, example, success , error button want apply different background color them.

right now, i'm doing jquery's extend function:

<span style={$.extend({background: 'forestgreen'},this.state.buttonstyle)}></span> 

but i'm wondering if there better , maybe more readable solution this. advice?

if use transpiler implements spread property proposal (such babel), can write

style={{...this.state.buttonstyle, background: 'forestgreen'}} 

instead.

whether thats "better" or more readable subjective.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -