
import React from 'react';
import ProductDetail from '../page/ProductDetail';
import { Navigate } from 'react-router-dom';
const PrivateRoute = ({authenticate}) => {
return authenticate === true?<ProductDetail/>:<Navigate to="/login"/>
}
export default PrivateRoute
http://localhost:3000/product/1
url 주소에서 파라미터는 제일 뒤에 있는 1이라는 숫자이다. id값이 들어와 있다.
파라미터값을 읽어와야할때 useParams hook이다.
쿼리스트링(query string)은 웹 주소(URL)에 추가적인 매개변수를 전달하는 방법 중 하나이다.
쿼리스트링은 URL의 끝에 "?" 문자로 시작하며, 이후에 "이름=값" 형태의 매개변수들이 "&" 문자로 구분되어 나열된다.
navigate(/?q=${keyword}) --> 쿼리스트링(query string) 입력하기