In React/ES6, is there a more concise way to write a ternary that references an attribute?

Viewed 45

In my code right now, I have a bunch of code like this: starterValue={ elementToEdit ? elementToEdit.size : null }

I can't do elementToEdit.size || null or something like that because of elementToEdit isn't defined, it obviously can't get its attribute.

Is there a more concise way to write this or should I just deal? Thanks

5 Answers
Related