Equivalent dangerouslySetInnerHTML?
See original GitHub issueI’m having trouble using UTF-8 entities in <Text>
elements. For example, the following will work as expected:
<Text>®</Text>
But this will not:
var txt = '®';
return <Text>{txt}</Text>
I’m assuming it’s because variables get escaped at some point - is there an equivalent dangerouslySetInnerHTML
for Text components?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Safe alternative to dangerouslySetInnerHTML - Stack Overflow
Alternative 1: Rewrite your app to pass data to components instead · Alternative 2: Don't write your own page builder · Alternative 3...
Read more >Using dangerouslySetInnerHTML - Getting Started with DOM
This article will discuss dangerouslySetInnerHTML in React and how it ... There isn't a prebuilt alternative to the dangerouslySetInnerHTML ...
Read more >Using dangerouslySetInnerHTML in a React application
This article covers the reasoning behind using the dangerouslySetInnerHTML property in a React application, which is the equivalent of the ...
Read more >Dangerously set innerHTML alternative | remarkablemark
An alternative to React's dangerouslySetInnerHTML is html-react-parser, which converts an HTML string to React elements.
Read more >DangerouslySetInnerHTML in React JS Explained
dangerouslySetInnerHTML is an attribute under DOM elements in React. According to the official documentation, dangerouslySetInnerHTML is React's replacement ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We don’t use HTML for rich text on the native side at all. I suspect (although I’m not 100% sure) that the reason the first example works is that the JSX parser converts the entity into the equivalent unicode character.
So to make the second example work, you should probably use JavaScript-style unicode escaping instead of XML/HTML-style escaping - i.e.
I meet the same problem,any one have solution?