Skip to content
Advertisement

react-markdown and renderers with arguments

I am using React Markdown (https://www.npmjs.com/package/react-markdown) to render markdown content in my NextJS project.

I have created a simple component named “ImageRenderer” and I need to pass an argument (in this case the slug) in addition props, to this component but I do not know how:

My page.js

JavaScript

The component:

JavaScript

Advertisement

Answer

Try this solution. Create an anonymous function and return your component from it with the necessary props

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement