Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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