Commit be0a7340 authored by kusang96's avatar kusang96
Browse files

href 처리중

parent 96d53c8a
...@@ -18,10 +18,9 @@ function App() { ...@@ -18,10 +18,9 @@ function App() {
return ( return (
<div> <div>
{console.log("match.params=",match.params(product))} <Router>
<MainNav /> <MainNav />
<SubNav /> <SubNav />
<Router>
<Switch> <Switch>
<Route exact path="/" component={Home} /> <Route exact path="/" component={Home} />
<Route path="/login" component={Login} /> <Route path="/login" component={Login} />
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Redirect } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Navbar, Nav, NavDropdown } from 'react-bootstrap'; import { Navbar, Nav } from 'react-bootstrap';
import axios from 'axios'; import axios from 'axios';
import catchErrors from '../utils/catchErrors'; import catchErrors from '../utils/catchErrors';
...@@ -16,7 +16,7 @@ function SubNav() { ...@@ -16,7 +16,7 @@ function SubNav() {
Object.keys(response.data[0]).forEach((ele) => { Object.keys(response.data[0]).forEach((ele) => {
const url = ele.toLowerCase() const url = ele.toLowerCase()
list.push( list.push(
<Nav.Link href={`/product/${url}`}>{ele}</Nav.Link> <Nav.Link as={Link} to={`/product/${url}`}>{ele}</Nav.Link>
) )
}) })
setCategorysDiv(list) setCategorysDiv(list)
......
...@@ -2,7 +2,8 @@ import React, { useState, useEffect, useRef } from 'react'; ...@@ -2,7 +2,8 @@ import React, { useState, useEffect, useRef } from 'react';
import Pagination from '../Components/Pagination'; import Pagination from '../Components/Pagination';
import { Container, Row, Col, Form, FormControl, Button, Card, Dropdown } from 'react-bootstrap'; import { Container, Row, Col, Form, FormControl, Button, Card, Dropdown } from 'react-bootstrap';
function ProductsList() { function ProductsList(props) {
const
const [sub, setSub] = useState(['PADDED JACKET', 'JACKET', 'JUMPER', 'COAT', 'FLEECE', 'CARDIGAN / VEST']) const [sub, setSub] = useState(['PADDED JACKET', 'JACKET', 'JUMPER', 'COAT', 'FLEECE', 'CARDIGAN / VEST'])
// useEffect(() => { // useEffect(() => {
...@@ -25,7 +26,7 @@ function ProductsList() { ...@@ -25,7 +26,7 @@ function ProductsList() {
return ( return (
<div> <div>
{console.log("match.params=",props.match.params.product)}
<style type="text/css"> <style type="text/css">
{` {`
.btn { .btn {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment