联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp2

您当前位置:首页 >> CS作业CS作业

日期:2018-11-14 10:48

Question 1.

Let’s bring in some data. Add the QandA.json file to the src folder and use import qAndAs from './QandA.json' to import the array of questions and answers into the qAndAs variable.

Modify your React code (and CSS if you like) to display information about the questions and answers. I did something like this to show the size of the array and the format of the objects (I used JSON.stringify):


(a)

Show your modified code and screen shot here.

Question 2.

Now that we’ve gotten familiar with React let’s break down our application from earlier this year into React components. Consider the marked up screenshot shown below.


In this diagram I show breaking the application up into three main panels: a control panel, a Question and Answer and a Create Question?panel (see homework three for complete views). In addition we will put all these components into an App component that will contain the state.

(a)

Create an App component that will hold the array of questions, the current question, answer visibility as its state. Show the code for this class here (don’t show imports or exports).

(b)

Create a QandAPanel component to hold the question and answer, this component should also take some type of “show answer” property to determine whether to show the answer or not. Show the code for this class here.

(c)

Add methods to the App component to increment and decrement the current question, to toggle the answer visibility. We will need to pass these as call backs to the component in part (b). Show these new methods here.

(d)

Create a ControlPanel component that will contain all the buttons, the current question indicator, and the total number of questions. Pass the functions from part (a) in as properties and attach them as event handlers of the buttons. Change the title on the answer button to toggle between Show Answer and Hide Answer as appropriate. Make sure all these buttons work. Show code for this class here.

(e)

Finish up the application by adding functionality to show and hide the Question/Answer creator, add question, and delete current question.

Show the code for the question created class here.

(f)

Show the code for the add and delete question methods in the App class. You will be passing these to the the question creator and control panel classes.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp