Skip to content

Unhandled Runtime Error. TypeError: ReactHtmlParser is not a function #83

Open
@Perfect-Dav

Description

@Perfect-Dav

Hello, I'm using react-html-parser with Next.js. I tried converting an HTML string to actual HTML. I got error instead.

What could be wrong?

import dynamic from "next/dynamic";

const ReactHtmlParser = dynamic(
    () => {
      return import('react-html-parser');
    },
    { ssr: false }
);

export default function Profile({ profileData }) {

  const ExtendedProfileShow = [
        profileData.businessInfo.extendedProfile.map((showExtendedProfile) => 
            <div key={showExtendedProfile.title}> {showExtendedProfile.title} <br/> 
                {showExtendedProfile.info} 
            </div>)
    ];

return (
  <div>
    {ReactHtmlParser(ExtendedProfileShow)}
  </div>
);

}

Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions