-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different formats of tag lists #5
Comments
That is a good point. We could switch them both to arrays, or we could switch them both to objects and then tweak the logic whereby we get the "converter" for each element type which starts here: https://github.com/CondeNast/jsonmltoreact/blob/master/src/utils.js#L171. Probably switching to arrays is cleaner. Admittedly I was just copying React and thought there might be a good reason why they chose object, but probably that reason is something isolated to their coding aesthetic because there's no way the performance varies tangibly between object and array for something this small. |
to the degree that we are able, I would suggest we conform to |
If you look carefully, export const reactConverters = reactHTMLTags.reduce((acc, type) => {
acc[type] = type;
return acc;
}, {}); Changing In regards to My suggestion is that we move const voidElementTagsList = [
'area',
'base',
...
];
export const voidElementTags = voidElementTagsList.reduce((acc, type) => {
acc[type] = true;
return acc;
}, {}); |
The
reactHTMLTags
andvoidElementTags
lists are very different in terms of structure, requiring different lookup methods in each list. I get one of them was lifted from external source, but it would substantially reduce confusion if each were either an array or an object with true values.https://github.com/CondeNast/jsonmltoreact/blob/master/src/utils.js#L7-L165
The text was updated successfully, but these errors were encountered: