Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add multiple style attributes in react element

style is just an Object, with css value turn to camelCase, so you could use any way to merge two object, and it should work.

ES6: style={Object.assign({}, style1, style2)}

ES7: style={{...style1, ...style2}}

lodash: style={_.merge({}, style1, style2)}
 
PREVIOUS NEXT
Tagged: #add #multiple #style #attributes #react #element
ADD COMMENT
Topic
Name
2+1 =