xml-to-react
xml-to-react copied to clipboard
Convert XML nodes to custom elements by default
Currently, we require converters to be defined to do anything. But as of React 16.x (if not earlier?), we can render custom/arbitrary tag names. This means that we can turn an XML document into a React tree without any provided converters.
e.g.
import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
renderToStaticMarkup(createElement('foo'));
// => <foo></foo>
I'd like to propose that this be our default behavior.
i like this. it feels as if it will solve some edge cases
separately, i'd love an option in the constructor to throw an error / report a warning when an XML node is found without a converter
You mean a constructor option to control whether or not we alert the library user of this issue? that makes sense. Naming the interface will be hardest. We'll have to do a bit of research I think.