Skip to content Skip to sidebar Skip to footer

Why Does React Only Allow A Subset Of Html Entities?

The only relevant documentation I found on this issue simply says that I can use HTML entities in React. However, this doesn't entirely seem to be the case. For example, &

Solution 1:

ReactJS only supports HTML4 special entities.

This might be intentional, although the documentation is unclear about it. My guess would be that HTML entities are commonly used to mask characters that are used in code as well, but since ReactJS has Unicode support, it's not as needed to make use of the new entities that can be represented in Unicode.

You can find a list of HTML4 entities here.


Solution 2:

Sorry, but only HTML4 elements are supported unfortunatelly


Solution 3:

| and # are new character entities from HTML5 specification.
& and ∑ are character entities from HTML4 specification (better visualised here).

JSX Rendering results show that character entities from only HTML4 specification are allowed.


Post a Comment for "Why Does React Only Allow A Subset Of Html Entities?"