我想在这个jsx中添加一个额外的空间

时间:2018-02-16 16:28:50

标签: javascript reactjs functional-programming jsx

1. "Blah blah blah" 
2. "Blah blah blah"

我希望这会返回类似的内容:

1. "Blah blah blah" 2. "Blah blah blah"

现在看起来像:

SELECT CompanyName, 'Supplier'
FROM suppliers
UNION
SELECT CompanyName, 'Customers'
FROM customers
ORDER BY CompanyName ASC;

1 个答案:

答案 0 :(得分:0)

将孩子包裹在一个div中。

showResults = () => {
  return(
    <div>
     <p> {this.state.queryData.map((i, index) => <div>{index+1 + " :" + i}</div>)} </p>
    </div>
  )
}

或者更好的是,做地图然后在

中添加“p”
showResults = () => {
  return(
    <div>
     {this.state.queryData.map((i, index) => <p>{index+1 + " :" + i}</p>)}
    </div>
  )
}