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

339
Visualizações
How to import .jsx files to .js files in reactJS

I m using node.js for this and using react as frontend, Now how do I import app.jsx file to index.js file? index.js

import App from "./components/app";

ReactDOM.render(<App text="Hello world"/> , document.getElementById('root'))

app.jsx


function App(props){
    return <h1>{props.text}</h1>
}

export default App;

now at last in app.jsx file I tried to import/require the React file but I get an error "require is not defined"

also in console when importing app.jsx it says require is not defined i m using import and that's what it says

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

if there is "type":"module" in package.json, remove it.

about 4 years ago · Juan Pablo Isaza Relatório

0

Did you type code below at the top in index.js and app.jsx file?

// app.jsx
import React from "react";

// index.js
import React from "react";
import ReactDom from "react-dom";

or maybe you type "require" code in the wrong line. Check it!

about 4 years ago · Juan Pablo Isaza Relatório

0

use npx create-react-app in your terminal to create new starter react app, you will see the working code over there. link for more info https://create-react-app.dev/docs/getting-started

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