Best practice when adding whitespace in JSX

前端 未结 9 810
粉色の甜心
粉色の甜心 2020-12-02 11:35

I understand how (and why) to add a whitespace in JSX, but I am wondering what\'s best practice or if any makes any real difference?

Wrap both elements in a

9条回答
  •  鱼传尺愫
    2020-12-02 12:16

    I tend to use  

    It's not pretty but it's the least confusing way to add whitespace I've found and it gives me absolute control over how much whitespace I add.

    If I want to add 5 spaces:

    Hello     World!

    It's easy to identify exactly what I'm trying to do here when I come back to the code weeks later.

提交回复
热议问题