0

I do not know how to import a markdown file with react markdown-to-jsx

constructor(props) {
  super(props);
  this.state = {}
}
render() {
  return ( <div> <File/><Markdown>asd</Markdown></div>);
}

as you can see above but I want something like

constructor(props) {
  super(props);
  this.state = {}
}
render() {
  return (
   <div>
    <File />
     <Markdown source="./markdownfile.md">
     </Markdown>
  </div>);
}
coderpc
  • 4,119
  • 6
  • 51
  • 93
  • Just a clarification. Do you need the contents of the markdown file to be rendered under the markdown tag ? if so, you could refer https://stackoverflow.com/questions/42928530/how-do-i-load-a-markdown-file-into-a-react-component – Ashwin R Sep 23 '20 at 17:25
  • Does this answer your question? [React fetch data in server before render](https://stackoverflow.com/questions/30929679/react-fetch-data-in-server-before-render) – Lionel Rowe Sep 23 '20 at 17:28
  • @AshwinR the question is more how can I import a markdown file with the markdown-to-jsx component. Because if I use react-markdown I can not style it with css – Dave Bouman Sep 23 '20 at 17:36
  • It's not component specific. Fetch data, set state, render from state. – Lionel Rowe Sep 23 '20 at 17:41
  • Thank you I will try it out – Dave Bouman Sep 23 '20 at 17:45

0 Answers0