In this chapter we will tackle how to create various components on the newly setup project.
- Modify the title component so that is shows the current page location
- Modify the title class style
- Create a new folder called
homeunderpublic - Create a new
homePage.jsfile and useexport default content
- Create a new folder called
aboutunderpublic - Create a new
aboutPage.jsfile and useexport default content;
- Import content as aboutContent into view.js
- Import content as homeContent into view.js
- Modify content of view.js by using
switchcaseto modify content based on current page location
-
Add a button in the
homepage which purpose will be to take the user toaboutpage:- This should have title "About"
- Should use one an icon:
info - Should print to the console its purpose
-
Add a button in the
homepage to get the username:- Should use one
iconPersonicon - Should print to the console its purpose
- Should use one
-
Add a button in the
aboutpage which purpose will be to take the user tohomepage:- This should have title "Home"
- Should use an icon
- Should print to the console its purpose
-
Add a button in the
aboutpage which purpose will be to request data about the application:- Add a title to it
- Should use an icon
- Should print to the console its purpose
- Class should have a constructor
- Constructor should initialize super() and userName
- Write a
getUserNamemethod which will return the userName and will be used by the "User" button - Write a
setUserNamemethod which will set the user to your name - Add a label component in the home page which should use
getUserNamemethod to display the user. - Use the
setUserNamemethod to change the label to your username when pressing the user button - Press button. Was the label updated?
- Observable model - missing
this.notify()
- Class should have a constructor
- Constructor should
- initialize super()
- an empty JSON variable details in which data will be placed
- a requestedTimes variable
- Add a method to
getDetailswhich will set the JSON variable and increment the requestedTimes variable
- Constructor should
- The table should be filled with data from the
getDetailsmethod implemented earlier which is being called by the button with the same purpose
Make use of QueryRouter
- Add functionality to the 2 buttons (in home and about pages) to take the user from one page to the other