const [view, setView] = useState('productList')
const switchView = (option) => {
setView(option)
setSelectedProduct(null) // Reset selectedProduct when switching views
}
{view === 'productList' && }
{view === 'cart' && }
{view === 'productDetails' && selectedProduct && }
Top comments (0)