티스토리 뷰
기존처럼
routes.js에 :id추가
index.js에서 하나 만들어줌
상품디테일 페이지에서 import 해 주기
import {f7route} from "framework7-react";
api에서 만들어준 getItemDetail import 해 주기
import { getItemDetail } from "../common/api";
f7route를 받아서
const ItemDetail = (f7route) => {
const [items, setItems] = useState([]);
useEffect(() => {
async function itemList() {
const resultItems = await getItemDetail(f7route.id);
setItems(resultItems.data);
}
itemList();
}, []);
상세페이지 눌렀을 때, 각 items id별로 상세페이지 가져와짐 확인
참고
framework7.io/docs/routes.html
Routes | Framework7 Documentation
Routes Define Routes First of all, when we init the Framework7 app we should pass default routes using routes array parameter: var app = new Framework7({ routes: [ { name: 'about', path: '/about/', url: './pages/about.html', }, { name: 'news', path: '/news
framework7.io
'루비온레일즈' 카테고리의 다른 글
상품 리스트 페이지에 각 아이템 가져오기 (0) | 2021.04.30 |
---|---|
[Error] 레일즈 서버 A server is already running 오류 / redis 서버 오류 해결 (0) | 2021.04.24 |
[Ruby On Rails] JWT (& JWT로 로그인) (0) | 2021.04.24 |
[Ruby On Rails] M:N Relation & Like(찜) model 만들기 (0) | 2021.04.24 |
[Ruby On Rails] 레일즈 서버 시작 & 초기 세팅 & model 만들기 (0) | 2021.04.24 |
댓글