I Want to add 2 array const in 1 file in React JS.
I want to print Breakfast Menu when a link is selected and Lunch Menu similarly but I want to keep them in 1 file
I didn't change the name of Note file because it gave an error of file not found
This is my GitHub repo: https://github.com/mareyam/Maryam-s-Company-Menu
And here is my project structure:
Note file
const BreakfastMenu = [
{
id:1,
h:"Eggs",
p:"eggs",
},
{
id:2,
h:"Milk",
p:"milk",
}
]
const LunchMenu = [
{
id:1,
h:"Tomato",
p:"eggs",
},
{
id:2,
h:"Milk",
p:"milk",
}
]
export default {BreakfastMenu, LunchMenu};
breakfast file
import React from 'react';
import BreakfastMenu from "./BreakfastMenu";
import Menu from "./Menu";
function nCard(val)
{
return(
<Menu
h={val.h}
p={val.p}
/>
);
}
const Breakfast = (props) =>
{
return (
BreakfastMenu.map(nCard)
)
}
export default Breakfast;
