FSD Lab Program-16
FSD Lab Program-16
16. Build a music store application using react components and provide routing
among the web pages.
cd music-store
npm start
import './App.css';
function App() {
return (
<Router>
<div className="music-store">
<nav>
<Link to="/">Home</Link>
<Link to="/store">Store</Link>
<Link to="/contact">Contact</Link>
</nav>
<Routes>
</Routes>
</div>
</Router>
);
function Home() {
return (
<div>
</div>
);
const albums = [
{ id: 3, title: "The Dark Side of the Moon", artist: "Pink Floyd", price: "₹1099" }
];
function Store() {
return (
<div>
<h2>Music Store</h2>
<ul>
{albums.map((album) => (
<li key={album.id}>
</li>
))}
</ul>
</div>
);
function Contact() {
return (
<div>
<h2>Contact Us</h2>
<p>Email: [email protected]</p>
</div>
);
.music-store {
text-align: center;
nav {
margin: 20px;
nav a {
margin: 10px;
padding: 10px;
text-decoration: none;
background-color: #007bff;
color: white;
border-radius: 5px;
nav a:hover {
background-color: #0056b3;
ul {
list-style: none;
padding: 0;
li {
margin: 10px 0;
padding: 10px;
border-radius: 5px;
background-color: #f9f9f9;
Explanation:
npm start