In a react project, the end user can generate CSS using a tool.
I found how to generate JS object and pass it to style={} attribute but I want to convert the generated JS object to CSS string, so I can save it and use it in other places.
I want to convert JSObject to CSS:
JSObject [Sample - Input]
JSObject: {
lineHeight: 1,
fontSize: 15,
padding: 0,
margin: 0,
msBoxShadow: '0 0 1px 1px #000',
MozBoxShadow: '0 0 1px 1px #000',
OBoxShadow: '0 0 1px 1px #000',
WebkitBoxShadow: '0 0 1px 1px #000',
boxShadow: '0 0 1px 1px #000'
}
Expected CSS [Sample - Output]
.cssClass{
line-height: 1;
font-size: 15px;
padding: 0px;
margin: 0px;
box-shadow: rgb(0, 0, 0) 0px 0px 1px 1px;
}