This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
npx create-next-app@latest nome-projeto
npm install react-bootstrap bootstrap
npm i axios
npm run dev
import React from "react";
const index = () => {
return <div>index</div>;
};
export default index;
- rafce
- pages/index.jsx
import React from "react";
import Cabecalho from "../components/Cabecalho";
const Home = () => {
return (
<div>
<Cabecalho />
</div>
);
};
export default Home;
- componentes/Cabecalho.jsx
import React from "react";
const Cabecalho = () => {
return <div>Cabeçalho</div>;
};
export default Cabecalho;
const Pagina = (props) => {
return (
<>
<Cabecalho />
<div className="bg-secondary py-3 text-white text-center mb-3">
<Container>
<h1>{props.titulo}</h1>
</Container>
</div>
{props.children}
<div
style={{ width: "100%" }}
className="bg-secondary position-fixed bottom-0 py-3 text-white text-center"
>
<p>Todos os direitos reservados®</p>
</div>
</>
);
};
const Home = () => {
return (
<>
<Pagina titulo="Página Inicial">
<Container>
<h1>Hello World</h1>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</Container>
</Pagina>
</>
);
};
{
carros.map((carro, index) => <p key={index}>{carro}</p>);
}