Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
Cannot convert markdown to html using - marked in reactjs

I used it in other file where it works properly but this is the following error for a different file: Uncaught Error: marked(): input parameter is undefined or null

import React from 'react';
import axios from "axios";
import { marked } from 'marked';
import { Grid, Typography, Box } from '@material-ui/core'

export default class GetBlogs extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            blog_json: [],
        };
    }

    componentDidMount() {
        axios.get(`/api/blog/${this.props.match.params.slug}/?format=json`)
        .then((result) => {
            this.setState({ blog_json: result.data })
        })
        .catch(error => {
            console.log(error)
        })
    };

    render() {
        const blog = this.state.blog_json;
        return (
            <Grid container justifyContent="center" alignItems="center">
                <Grid xs={12} sm={6} lg={6}>
                    <Box>
                        <Typography variant="h1" component="div" gutterBottom>{ blog.title }</Typography>
                        <Typography dangerouslySetInnerHTML={{__html: marked(blog.markdown)}}></Typography>
                        <Typography>{ blog.author }</Typography>
                        <Typography>{ blog.date } { blog.time }</Typography>
                    </Box>
                </Grid>
            </Grid>
        )
    };
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!