We are going to create a restaurant web page. Which will have two sections
- A list of menu items with item number, name and price
- A list of restaurant locations with address and phone number
- Fork and clone the repo
- Run
npm installafter cloning to download all dependencies - Run
npm run dev -- --watchto continuously build React in the background - Open
index.htmlin browser to view the result
Solve the tasks, one at a time. Each task will require an adjustment to material created for previous task. Check your work in the browser frequently to make sure all is working.
- Draw the layout of the website first using pen and paper. It should display a list of menu items and as it's a small chain of restaurants, it should also display a list of different locations.
- Create the web page as a single React component in
App.js - Create a
MenuItemandLocationcomponent to display respective pieces of information which will be passed in asprops. - Update the
Appcomponent to useMenuItemandLocationcomponents created for previous task. Pass the data to each component to display asprops. For example<MenuItem item={{id: 1, name: "Cheeseburger", price: 10 }} /> - Extract
propsdata passed toMenuItemandLocationcomponents into arrays. GenerateMenuItemandLocationcomponent lists by mapping over the data in the respective array and passing each item from the array to each respective component. Useids askeys. - Add some styling to your page to make it look good and responsive.