-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEXTLEVEL 클린코드 리액트 호준] 장바구니 미션 Step1 #7
base: ganeodolu
Are you sure you want to change the base?
Changes from 1 commit
2d00bb6
0d31c6f
57f112b
f71e105
c6608c5
955bbc7
3fc75b4
6f70fbf
35931a6
bbca140
f9965d5
411aec7
c027b53
7891113
be4ad0f
50e6815
00a5b7d
26ec755
021b1ba
2aa2977
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
import React from 'react'; | ||
import { QueryClientProvider, QueryClient } from 'react-query'; | ||
import { Routes, Route } from "react-router-dom"; | ||
import ProductList from './pages/ProductList'; | ||
import Cart from './pages/Cart'; | ||
import OrderList from './pages/OrderList'; | ||
// import Home from './pages/Home'; | ||
import GNB from './components/GNB'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
const App = () => { | ||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<div className="App">My React App</div> | ||
</QueryClientProvider> | ||
); | ||
<QueryClientProvider client={queryClient}> | ||
<GNB /> | ||
<Routes className="App"> | ||
{/* <Route path="/" element={<Home />} /> */} | ||
<Route path="/" element={<ProductList />} /> | ||
<Route path="/carts" element={<Cart />} /> | ||
<Route path="/orders" element={<OrderList />} /> | ||
</Routes> | ||
</QueryClientProvider> | ||
); | ||
} | ||
|
||
export default App |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const GNB = () => { | ||
const history = useNavigate(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. history 라고 적으셔서 useHistory()를 사용하신 줄 알았습니다ㅎㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 말씀하신 내용과 정확히 같아요ㅎㅎ useNavigate를 사용할때 변수명을 보통 어떻게 정하시나요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 그냥 navigate로 사용하고 있습니다ㅎㅎㅋ |
||
|
||
return ( | ||
<div> | ||
<nav className="nav flex justify-around"> | ||
<div className="flex-center"> | ||
<h1 className="nav-title" onClick={() => history("/")}> | ||
CLEAN CODE SHOP | ||
</h1> | ||
</div> | ||
<div className="flex gap-15"> | ||
<button className="nav-button" onClick={() => history("/carts")}> | ||
장바구니 | ||
</button> | ||
<button className="nav-button" onClick={() => history("/orders")}> | ||
주문목록 | ||
</button> | ||
</div> | ||
</nav> | ||
</div> | ||
); | ||
} | ||
|
||
export default GNB |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<div id="root"></div> | ||
</body> | ||
|
||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import App from "./App"; | ||
|
||
ReactDOM.render(<App />, document.getElementById("app")); | ||
ReactDOM.render( | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter>, | ||
document.getElementById("root"), | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
const Cart = () => { | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default Cart |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
const Home = () => { | ||
return ( | ||
<div> | ||
d | ||
</div> | ||
) | ||
} | ||
|
||
export default Home |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
const OrderList = () => { | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default OrderList |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
const ProductList = () => { | ||
return ( | ||
<div> | ||
p | ||
</div> | ||
) | ||
} | ||
|
||
export default ProductList |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -921,7 +921,7 @@ | |
"@babel/plugin-transform-react-jsx-development" "^7.16.7" | ||
"@babel/plugin-transform-react-pure-annotations" "^7.16.7" | ||
|
||
"@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": | ||
"@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": | ||
version "7.17.2" | ||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941" | ||
integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw== | ||
|
@@ -3241,6 +3241,13 @@ he@^1.2.0: | |
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" | ||
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== | ||
|
||
history@^5.2.0: | ||
version "5.3.0" | ||
resolved "https://registry.yarnpkg.com/history/-/history-5.3.0.tgz#1548abaa245ba47992f063a0783db91ef201c73b" | ||
integrity sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ== | ||
dependencies: | ||
"@babel/runtime" "^7.7.6" | ||
|
||
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: | ||
version "3.3.2" | ||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" | ||
|
@@ -4359,6 +4366,21 @@ react-redux@^7.2.6: | |
prop-types "^15.7.2" | ||
react-is "^17.0.2" | ||
|
||
react-router-dom@^6.2.1: | ||
version "6.2.1" | ||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.2.1.tgz#32ec81829152fbb8a7b045bf593a22eadf019bec" | ||
integrity sha512-I6Zax+/TH/cZMDpj3/4Fl2eaNdcvoxxHoH1tYOREsQ22OKDYofGebrNm6CTPUcvLvZm63NL/vzCYdjf9CUhqmA== | ||
dependencies: | ||
history "^5.2.0" | ||
react-router "6.2.1" | ||
|
||
[email protected]: | ||
version "6.2.1" | ||
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.2.1.tgz#be2a97a6006ce1d9123c28934e604faef51448a3" | ||
integrity sha512-2fG0udBtxou9lXtK97eJeET2ki5//UWfQSl1rlJ7quwe6jrktK9FCCc8dQb5QY6jAv3jua8bBQRhhDOM/kVRsg== | ||
dependencies: | ||
history "^5.2.0" | ||
|
||
react@^17.0.2: | ||
version "17.0.2" | ||
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
따로 주석 남겨두신 이유가 있으신가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 url을 기준으로 api를 적용해볼까 생각하여 상품목록부분의 주소를 /product로 하고 싶어서 따로 남겨둔 아직 미완인 부분입니다.