😎 κ³΅λΆ€ν•˜λŠ” μ§•μ§•μ•ŒνŒŒμΉ΄λŠ” μ²˜μŒμ΄μ§€?

[E-Commerce App with Fullstack] (5) React Setup λ³Έλ¬Έ

πŸ‘©‍πŸ’» λ°±μ—”λ“œ(Back-End)/Node js

[E-Commerce App with Fullstack] (5) React Setup

μ§•μ§•μ•ŒνŒŒμΉ΄ 2023. 5. 1. 23:53
728x90
λ°˜μ‘ν˜•

<λ³Έ λΈ”λ‘œκ·ΈλŠ” Techinfo YT μ˜ 유튜브λ₯Ό μ°Έκ³ ν•΄μ„œ κ³΅λΆ€ν•˜λ©° μž‘μ„±ν•˜μ˜€μŠ΅λ‹ˆλ‹€ :-)>

=> Mern stack Ecommerce App Lets Build And Deploy Mern Stack Project full-stack development

 

☘️ React Setup

npx create-react-app client
cd client
npm start

 

πŸ’š publish/index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>React App</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>

 

πŸ’š src/components/Layout/Footer.js

import React from "react";

const Footer = () => {
  return (
    <>
      <h1>Footer</h1>
    </>
  );
};

export default Footer;

 

πŸ’š src/components/Layout/Header.js

import React from "react";

const Header = () => {
  return (
    <>
      <h1>Header</h1>
    </>
  );
};

export default Header;

 

πŸ’š src/components/Layout/Layout.js

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

const Layout = (porps) => {
  return (
    <div>
      <Header />
      <main>{porps.childeren}</main>
      <Footer />
    </div>
  );
};

export default Layout;

 

πŸ’š src/App.js

import "./App.css";
import Layout from "./components/Layout/Layout";

function App() {
  return (
    <>
      <Layout>
        <h1>Ecommerce App</h1>
      </Layout>
    </>
  );
}

export default App;

 

πŸ’š src/index.css

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&display=swap');
* {
  margin:0;
  padding:0;
  box-sizing: border-box;
}

 

πŸ’š Routes Componentλ₯Ό κ΅¬ν˜„

npm i react-router-dom

 

728x90
λ°˜μ‘ν˜•
Comments