Maximus S
Maximus S

Reputation: 11095

React html characters inside input placeholder

How can I make the following work in React?

<input type="text" placeholder="&#xf124; Location" />

I looked at dangerouslySetInnerHTML but that is not for setting props such as placeholder

Upvotes: 2

Views: 877

Answers (1)

JMM
JMM

Reputation: 26787

You can use a JS string with escape sequence (I don't know what character U+f124 is so I substituted U+00C2 [Â], but it can be whatever code point):

<input type="text" placeholder={"\u00C2 Location"} />

Upvotes: 2

Related Questions