This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "javascript-development-environment", | |
"version": "1.0.0", | |
"description": "JavaScript development environment Pluralsight course by Cory House", | |
"scripts": { | |
}, | |
"author": "Cory House", | |
"license": "MIT", | |
"dependencies": { | |
"whatwg-fetch": "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This API wrapper is useful because it: | |
1. Centralizes our Axios default configuration. | |
2. Abstracts away the logic for determining the baseURL. | |
3. Provides a clear, easily consumable list of JavaScript functions | |
for interacting with the API. This keeps API calls short and consistent. | |
*/ | |
import axios from 'axios'; | |
let api = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from "path"; | |
export default { | |
mode: "development", | |
devtool: "eval-source-map", | |
entry: "./src/index.js", | |
output: { | |
path: path.resolve(__dirname, "src"), | |
publicPath: "/", | |
filename: "bundle.js", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "javascript-development-environment", | |
"version": "1.0.0", | |
"description": "JavaScript development environment Pluralsight course by Cory House", | |
"scripts": { | |
}, | |
"author": "Cory House", | |
"license": "MIT", | |
"dependencies": { | |
"whatwg-fetch": "3.6.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At top, import immutable | |
import { Map } from 'immutable'; | |
// Later, in constructor... | |
this.state = { | |
// Create an immutable map in state using immutable.js | |
user: Map({ firstName: 'Cory', lastName: 'House'}) | |
}; | |
updateState({target}) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
courses: [ | |
{ | |
id: "clean-code", | |
title: "Clean Code: Writing Code for Humans", | |
watchHref: "http://www.pluralsight.com/courses/writing-clean-code-humans", | |
author: { | |
id: "cory-house", | |
name: "Cory House" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from "react"; | |
import PropTypes from "prop-types"; | |
import { Prompt } from "react-router-dom"; | |
// Prompt the user onbeforeunload or when navigating away by clicking a link | |
export default function PromptOnUnload({ when, message }) { | |
const enabled = when; | |
useEffect(() => { | |
if (!enabled) return; | |
const handleBeforeUnload = (event) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install auth0-js@9.13.4 auth0-lock@11.25.1 express@4.17.1 express-jwt@5.3.1 express-jwt-authz@1.0.0 jwks-rsa@1.3.0 npm-run-all@4.1.5 react-router-dom@5.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
authors: | |
[ | |
{ | |
id: 'cory-house', | |
firstName: 'Cory', | |
lastName: 'House' | |
}, | |
{ | |
id: 'scott-allen', |