Skip to content

Instantly share code, notes, and snippets.

Testing Apps with Router and Network Requests (Asychronous Code)

Router

With React Router, any component that uses a part of the react-router-dom library (like Route, Link, Navlink, etc.) needs to have access to a Router component. Since the BrowserRouter (which is a type of Router) lives in the index.js file something like this:

// index.js

import { BrowserRouter } from 'react-router-dom';

React Router Testing - Exercise Submission

Submit your links below in markdown format as follows:

[Title of link](URL to JS file containing routing tests)

  1. [React Router lesson tests](URL)
  2. [Project Router tests](URL)
require('dotenv').config();
const fs = require('fs');
const tripReportData = require('./data/trip-reports.json');
const condensedPeakReports = tripReportData.map((peak) => {
const condensedReports = peak.tripReports.map((trip) => {
return trip.report;
}).join(' ');
return {name: peak.peakName, text: condensedReports};
const Nightmare = require('nightmare');
const fs = require('fs');
const peakUrls = require('../data/peak-urls.js');
const goToPageAndGetData = async (pageLink) => {
try {
const nightmare = new Nightmare({ show: false });
const result = await nightmare

Final Assessment Submission

Submit a comment below with a link to your final assessment's GitHub repository and a link to your Heroku site.

1706FE Final Assessment Submissions

In a comment to this gist, add a link to your final assessment GitHub repo and your Heroku URL.

1705FE Final Assessment Submissions

In the comments below, submit links to your GitHub repo and production app.

PWA Intro Lesson - The Manifest

Outline

  • Talk about native app experience - how it differs from a normal we app
  • Add manifest file to project (see that it's working locally and then push this up to production)
  • Run audits using the lighthouse app (enabled by default in Chrome Canary) - PWA audits only
  • Implement HTTP redirect for HTTPS in server file

Native App vs. PWA

1703FE Final Assessment Submission

In the comments below, add a link to your GitHub repo and a link to your production Heroku site.

Interview Questions

To help commit to memory, write down your responses in your notebook - do not type them on your computer.

General Web

  • In as much detail as possible, explain how you would localize an application.
  • Tell me two advantages of testing your code.
  • Name three strategies for fixing cross-browser inconsistencies.
  • What are some tools and strategies you use to prevent shipping unstable code to production?
  • What factors influence whether you’ll take a progressive enhancement vs. graceful degradation approach to building an application?