webahead14 / clinic-client

0 stars 3 forks source link

Checkbox question #1

Open Karyum opened 2 years ago

Karyum commented 2 years ago

Your task is to create a component where a user can see a question and checkboxes (allowed to choose multiple answers).

You will need to write the code in the <CheckboxButttonsQuestion /> component in the components folder, to see the component run the app and go to http://localhost:3000/survey/test/checkbox-question

Build the following question using this data:


const questionData = {
  questionText: 'In your opinion, which of the following choices impact your stress the most ?',
  answers: ['Smoking', 'Exercising', 'Drinking alcohol', 'Eating']
}

Copy the code and paste it into the component. for the answers don't render them like so answers[0] answers[1] make sure to use .map() to render, there are a lot of examples out there of React components with .map()

Chosen values must be saved in a react state

checkbox-question