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

305
Views
TypeError: marked__WEBPACK_IMPORTED_MODULE_3___default(...) is not a function

I'm working on an editor markdown in my current project. I searched on different questions on stackoverflow but that didn't help me to resolve my problem. I get this TypeError: enter image description here

This is my code:

  import React, {Component} from 'react';
  import './App.css';
  import {sampleText} from './sampleText'
  import marked  from 'marked'


  class App extends Component {
    state = {
      text: sampleText
    }
    
    handleChange = event => {
      const text = event.target.value
      this.setState({text})
    }

    renderText = text => {
      const _html = marked(text, { sanitize: true})
      return { __html}
    }
    

    render () {
      return(
        <div className='container'>
          <div className='row'>
            <div className='col-sm-6'>
              <textarea
                onChange={this.handleChange}
                value={this.state.text}
                className='form-control'
                rows='35'/>
            </div>
            <div className='col-sm-6'>
              <div dangerouslySetInnerHTML={this.renderText(this.state.text)}/>
            </div>
          </div>
        </div>
      )
    }
  }

  export default App;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like your import for marked is incorrect. It should be

import { marked } from 'marked'
about 4 years ago · Juan Pablo Isaza Report
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!