react-jsx-parser
A React component which can parse JSX and output rendered React Components.
Basic Usage - Injecting JSX as a String
Because InjectableComponent
is passed into the JsxParser.props.components
prop, it is treated as a known element type, and created using React.createElement(...)
when parsed out of the JSX.
Advanced Usage - Injecting Dynamic JSX
Any ComponentA
, ComponentB
, ComponentC
or ComponentD
tags in the dynamically loaded XML/HTML fragment will be rendered as React components. Any unrecognized tags will be handled by React
.
Note: Non-standard tags may throw errors and warnings, but will typically be rendered in a reasonable way.