import React, { useState } from "react"; import AddToCart1 from "./AddToCart1"; import AddToCart2 from "./AddToCart2"; function AddToCart() { const list = { 1: , 2: , }; const [type, setType] = useState(1); return (
{list[type]}
); } export default AddToCart;