Skip to content

Latest commit

 

History

History
22 lines (11 loc) · 988 Bytes

exercise 9.md

File metadata and controls

22 lines (11 loc) · 988 Bytes

Exercise 9: React Q&A, now with state

Goal: Getting started with the state by adding it to the "HeapOverrun" React app developed last week.

Adding the state

Define where to put the state in the app and how many state variables you need, reflecting on the pros and cons.

Use the 'fake' set of questions and answers to initialize the state. Update the existing components accordingly.

Implement the "vote up" function

Make the "vote up" function of each answer work! By clicking on the button associated with an answer, the information about the answer's score must be increased by 1.

Use the defined state and decide where to put the function to increase the score.

Add a new answer (I part)

Include a form on the question page to add a new answer. The form will appear under the answers' table and use controlled input components.

For the moment, define the suitable components to show the form without handling the insertion of a new answer in the table.