Junior — Senior
Random Software Jokes Display Component
livecode
Task condition
Develop a UI component that displays random programming jokes. The user should be able to click a button to get a new joke.
Requirements:
- When the page loads, a button labeled "Get a joke!" is displayed.
- When the button is clicked, the component sends a request to a public jokes API, such as the Official Joke API (https://www.joke.com/login.php?id=3).
- After receiving the response, the joke is displayed above the button.
- If the request fails or the API is unavailable, an error message is shown.
Optional (if desired):
- Add a loading indicator or animation while waiting for the response.
- Extract the request and related logic into a custom hook.