フロントエンド開発に役立つクライアントプログラム共通のノウハウ / Universal client-side programming best practices for frontend development

export const OrderHistoryPage: React.FC = () => { const navigate

= useNavigate(); const orders = [ { id: ‘1’, productName: ‘MacBook Pro’, status: ‘delivered’ as const, total: 298000 }, { id: ‘2’, productName: ‘iPad Air’, status: ‘shipped’ as const, total: 92800 } ]; const handleViewDetail = (orderId: string) => { navigate(`/orders/${orderId}`); }; const handleRequestInvoice = (orderId: string) => { navigate(`/orders/${orderId}/invoice`); }; return (

{/* 固定的な遷移は自己完結 */} {orders.map(order => ( handleViewDetail(order.id)} {/* 文脈的な遷移は制御 */} onRequestInvoice={() => handleRequestInvoice(order.id)} /> ))}

); };




Source link

関連記事

コメント

この記事へのコメントはありません。