remarkjs / react-markdown

Markdown component for React
https://remarkjs.github.io/react-markdown/
MIT License
13.24k stars 873 forks source link

components={{}} doesn't seem to do anything #568

Closed shyal closed 3 years ago

shyal commented 3 years ago

Subject of the issue

The components= prop doesn't seem to work for me.

Your environment

Steps to reproduce

          <ReactMarkdown
            components={{
              // components not working for some reason
              h2: ({ node, className, ...props }) => {
                return 'h1';
              },
              em: ({ node, ...props }) => <i style={{ color: 'red' }} {...props} />,
            }}
            className="dropcap blog"
            rehypePlugins={[rehypeRaw]}
            linkTarget="_blank"
            plugins={[math]}
            renderers={renderers}
            children={doc}
          />

Expected behavior

Rendered components should be processed.

Actual behavior

They are not.

ChristianMurphy commented 3 years ago

It is noted in the README

:warning: Note: the below readme is for the upcoming release of react-markdown@6.0.0. See the last released readme (5.0.3) here » https://github.com/remarkjs/react-markdown/tree/22bb78747d768181cb9ea8711b5e13c3768921d8#readme

components is a new property in v6, you are using v5. The rough equivalent in v5 is renderers.