Assignment 4

Development Environment

For this assignment, it is up to you if you'd like to use CodeSandbox or set up a React application locally using Create React App.

Requirements

For this assignment, you are going to build the following application using React: https://404-assignment-4-solution.surge.sh/. This application uses the icanhazdadjoke API similar to Assignment 2.

  • It must behave exactly the same as the example.
  • You must use fetch instead of $.ajax.
  • The initial AJAX call on page load must happen in the componentDidMount lifecycle method.
  • The list of jokes should use id as the unique key.
  • The loading indicator is optional.
  • Feel free to style it however you wish.

This API requires sending the Accept HTTP header. Here is an example of how to do that with fetch:

fetch('https://icanhazdadjoke.com/search?page=1', {
  headers: { Accept: 'application/json' },
});

Submission

Create your GitHub repository here: https://classroom.github.com/a/5T52A7s5.

If you used CodeSandbox, paste your link on a README.md file in the root of your repository and push up that file. You are done!

If you used Create React App, deploy your React project to Surge. Paste your Surge link on a README.md file in the root of your repostiory. Push up all of your code to your GitHub repository. You are done!