sexta-feira, 25 de março de 2016

A few exercises in React (a Javascript library for building user interfaces)

In the Services Engineering course, I proposed three exercises to students. A basic one, which is solved in the home page of React and two other, of growing difficulty, which I will solve in separate messages.
Solutions: 
- for exercise 1
- for exercise 2
- for exercise 3

1-    Write a React component that allows you to write text in a box and that copies the content of that box to a line, as you type.

2-     
a)     Write a service in Flask that, given the names and ages of several people in a text file, responds with the data in that file in JSON.

b)    Once you get that service running, write an HTML page and a REACT script that creates a listbox with the names given by the service. Consider the following HTML code for the listbox:

<select name="sometext" size="5">
      <option>text1</option>
      <option>text2</option>
      <option>text3</option>
      <option>text4</option>
      <option>text5</option>
      <option>text6</option>
      <option>text7</option>
      <option>text8</option>
      <option>text9</option>
      <option>text10</option>
</select>

c)     Ensure that the browser sees an updated list of persons, whenever the file changes.

3-    We now want to create two lists of persons, such that the user can change persons from one list to the other, as we show in this figure:



The list of persons should come from a file on the server’s disk. Furthermore, if this list changes, both web lists might change as well. Names that have disappeared should also leave the lists, while new names in the text file should show up on the left side list.

Sem comentários:

Enviar um comentário