Skip to content

exercise react

Miguel Gamboa edited this page Nov 11, 2024 · 1 revision

React Exercises

Periodic Fetcher

Create a component for the React library that receives a URL and a time period, in milliseconds. When mounted, this component must periodically perform an HTTP GET request to the provided URL. The result of the request should be presented in a textarea:

  • If the result was an HTTP response message, then the textarea must contain the response's body.
  • If the result was an exception, then the textarea must contain the exception text.

The component should also show an indication of whether an HTTP request is pending or not.

The component must react to changes in its properties, ensuring that there is at most one pending HTTP request at any time.

Create an example usage of this component by using a form with two input elements to collect the URL and the time interval.

Clone this wiki locally