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

97
Views
Babel React transpiling to `fileName.Component` instead of just `Component`

I am having to call my react component as component.Component, like below. Also to note, the first part is the file name. If the rename the file, I have to say (newFileName.LikeButton). enter image description here

instead of

ReactDOM.render(React.createElement(LikeButton) , domContainer);

Any idea how I can resolve this? Here is my setup. My babel.config.json

{
    "presets": ["@babel/preset-react", "@babel/preset-env" ],
    "plugins": [ "@babel/plugin-transform-modules-umd" ]
}

my react component in likeButton.jsx

export class LikeButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = { liked: false };
  }
 
  render() {
    if (this.state.liked) {
      return 'You liked this.';
    }

    return (<button onClick={() => this.setState({ liked: true }) }>
        Like
      </button>
      );
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Warning, this answer is speculative (but too long for a comment)

I suspect your imports look something like this:

import likeButton from './somePath/likeButton'

but, because you are using named exports, (as opposed to default exports), your import should actually look like:

import { LikeButton } from './somePath/likeButton'

to "destructure" LikeButton from the module.

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!