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

84
Visualizações
cannot render any of my code to my react-appliaction

I am making a Typescript and React app. I am using 4 main files, App.tsx, Header.tsx, Ap.css. I think the real problem is the way I am trying to use the add the Header.tsx file to App.tsx.

Please help

App.tsx:

import React from "react";
import Header from "./Header";
import "./App.css";

function App() {
  return (
    <div className="App">
      <Header />
    </div>
  );
}

export default App;

Header.tsx:

import React from "react";
import "./Header.css";

function Header() {
  return (
    <div className="nav-container">
      <nav>
        <a href="#!">Home</a>
        <a href="#!">About</a>
        <a href="#!">Projects</a>
        <a href="#!">Resume</a>
      </nav>
    </div>
  );
}
export default Header;

App.css:

.App {
  text-align: center;
  color: white;
}

body {
  background-color: #171A25;
  color: #ffffff;
}

Header.css:

body {
    margin: 0px;
    background-color: #121625;
}
.nav-container {
    text-align: center;
    font-size: 24px;
    color: white;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It looks like there is nothing wrong with your import method. I think you should check your webpack.config.js file. In resolve part should contain ts and tsx types.

resolve: {
        extensions: ['.tsx', '.ts', '.js'],
    },

and also you have to add tsconfig.json file to your project. https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

https://webpack.js.org/guides/typescript/

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