0

How do I write something that is equivalent to

CSS

.class {
  display: flex;
  display: -webkit-flex;
}

but using inline styles in React?

I'm basically looking for something like:

JavaScript

let styles = {
  display: ['flex', '-webkit-flex']
}
1

1 Answer 1

2

Your problem is a reactJS common problem still opened and waiting for a proper solution

For webkit style, one solution is to concat values:

let styles = {
  display: 'flex; display:-webkit-flex'
}

Otherwise, a more common solution is to create a CSS named 'flex' that will be given to the className property of your element.

Third solution: use Radium. I believe it too big & tedious for your problem but you can try it if you have time... :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.