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.


For this assignment, you are going to build the following application using React: 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('', {
  headers: { Accept: 'application/json' },


Create your GitHub repository here:

If you used CodeSandbox, paste your link on a 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 file in the root of your repostiory. Push up all of your code to your GitHub repository. You are done!