我是ReactJS的新手,我的应用程序出了问题。我有一个数组:
players: [
{ number: 1, name: "Ben Blocker", position: "G" },
{ number: 2, name: "Dave Defender", position: "D" },
{ number: 3, name: "Sam Sweeper", position: "D" },
{ number: 4, name: "Matt Midfielder", position: "M" },
{ number: 5, name: "William Winger", position: "M" },
{ number: 6, name: "Fillipe Forward", position: "F" },
{ number: 7, name: "Bobby Ristov", position: "<h1>Test</h1>" }
],
我想将H1
显示为HTML而不是文本。我试过它<h1>Hi there!</h1>
,但这也不起作用。我在这里错过了什么吗?任何帮助都会得到满足。
答案 0 :(得分:0)
它应该是一个元素,而不是字符串:
position: <h1>Test</h1>