+ 1
Do I have to make 500 html files to show my 500 product details pages? Or I can just do it inside one html file?
I have these confusions actually.... I never got a tutorial or any suggestions on this topic
11 Réponses
+ 4
you would have an array of all products and you would loop through the array and render them all on the screen. You can do it in javascript like:
let products = [
{ _id: 1, name: "Shirt", price: 100 },
{ _id: 2, name: "Pent", price: 150 },
]
products.forEach(product => {
document.getElementById("products-div").innerHTML += `
<div>
<h1>${product.name}</h1>
<h2>${product.price}</h2>
</div>
`
})
+ 2
Use a database to store your product details and dynamically load them into your page using any back end language of your choice.
+ 1
Thanks man it was helpful
+ 1
Noob Dev no problem :)
0
Noob Dev use reactjs with react-router and use dynamic routing.
0
How does that work actually?
0
Just need a little bit of explanation
0
Learn reactjs first
0
Thanks man
0
One css file is good enough for 5000 html pages 🙏
0
Hello.guys