Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
Can't figure out why my React Component isn't rendering?

Is there an issue with how I imported react or am I just missing something small? Any feedback would be greatly appreciated. I'm pretty new to programming so there's probably a really simple solution here that I'm just not informed enough to see. Thanks.

Edit: After taking out the commented out portion of the body, the component still doesn't render. I get this error

Uncaught SyntaxError: Unexpected token '<' (at index.html:22:13)

Can the file not understand that I'm trying to use a react component? Thanks.

2nd edit: Solved it, I was missing type="text/babel" in the script element.

    <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">


    <!-- React Import -->
    <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>

    <title>Markdown Previewer</title>
  </head>

    <script>
      class App extends React.Component {
        render() {
          return(
            <div class="">
            Hi
            </div>
          );
        }
      }

      ReactDOM.render(<App/>,
      document.getElementById('app'));
    </script>

  <body>
    <!--<wrapper>
      <div id="app"></div>
      <textarea name="name" rows="8" cols="80" id="editor"></textarea>
      <div id="preview"></div>
    </wrapper>-->
    <!-- JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
    <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>



  </body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

remove comment braces: <!-- -->

and write just:

<wrapper>
  <div id="app"></div>
  <textarea name="name" rows="8" cols="80" id="editor"></textarea>
  <div id="preview"></div>
</wrapper>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda