The contacts component isn’t rendering anything. I’ve provided the code for the contacts component and the app component. I reviewed all of the other components to make sure that everything is working as expected. So far the issue is only with the contacts component. I used the developer tools in the browser to see if there is any errors, but nothing there.
// Contacts.jsx
import React from "react";
const Contacts = () => {
return (
<form>
<div className="mb-3">
<label htmlFor="name" className="form-label">
Name
</label>
</div>
</form>
);
};
export default Contacts;
// App.jsx
import { ChakraProvider } from "@chakra-ui/react";
import Contacts from "./components/Contacts";
import Navbar from "./components/Header";
import DashBoard from "./components/LandingSection";
import Projects from "./components/Projects";
import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
function App() {
return (
<div>
<ChakraProvider>
<Router>
<Navbar />
<Routes>
<Route path="/" element={<DashBoard />} />
<Route path="/projects-section" element={<Projects />} />
<Route path="/contacts-section" element={<Contacts />} />
</Routes>
</Router>
</ChakraProvider>
</div>
);
}
export default App;
2
Answers
with the following code only
Name
gets displayed so check if its merging with navbar or if it is behind navbar . so It might be displaying but u r not able to see it. Try addingmt-24
to className like belowTry only rendering contact page at a time because sometimes it get hidden due to another components too. So try with commenting the component or try by removing the components as below:
Try this. It may help you.