1

I am new to ReactJS and I have a problem with my app. I have an array:

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>" }
  ],

And I would like to display the the H1 as HTML instead of text. I have tried it like this &lt;h1&gt;Hi there!&lt;/h1&gt; but that does not work either. Am I missing something here? Any help would be appriciated.

elmigue017
  • 343
  • 2
  • 12
Bobby
  • 135
  • 1
  • 1
  • 8
  • Check this, might help: https://stackoverflow.com/questions/39758136/render-html-string-as-real-html-in-a-react-component – G4bri3l Jul 22 '17 at 17:16

1 Answers1

0

It should an element, not string:

position: <h1>Test</h1>
hjrshng
  • 1,675
  • 3
  • 17
  • 30