Skip to content

Error: img is a void element tag and must neither have children nor use dangerouslySetInnerHTML #14

Closed
@poacher2k

Description

@poacher2k

Hi!

Great plugin, really think this is going to be helpful for what I'm working on.

I noticed that parsing any img-element causes the above error. This may also apply to any element that never should have child elements.

A temporary workaround is to use something like this:

const parserConfig = {
    replace: domNode => {
        if(domNode.type === DOM_TYPE_TAG && domNode.name === 'img') {
            return <img src={domNode.attribs.src} alt={domNode.attribs.alt} className={domNode.attribs.class} />;
        }
    }
};

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions