Henrik Høltzer (heho)
Webprogramming - WebApps with React, Angular and other JS-frameworks


Semester: 4.sem., Spring 2023
Email: heho@zealand.dk

Education guidelines and Objectives for the course
Resources:
lynda.com: https://www.lynda.com/Web-training-tutorials/88-0.html
Get a free School-Account to Lynda.com.



NB: The plan is preliminary and will properly be changed during the semester! (Last updated: 27.03.23)

Week
Topics
Literature/Material
Exercises/Notes
5
1/2

Introduction to the course

Goal for this Course?
WebTechnologies.docx (Overview 2021)
StateOfJs (2020) (JS Overview 2020)



LinkedIn Learning (Lynda.com): Create a linkedIn Learning Account (free for Zealand-students)
Udemy.com (not free, but the price is only about 10-20 euro per course)

Synopsis:
Synopsisdescription.html
Synopsis ideas

Examples:
Blazor.pdf
Jsoup.pdf
Crossplatformframeworks.pdf
ReactHooks.pdf

5
1/2

JavaScript (JS Basic)
JavaScript (JS Advanced Part1-2)
Global Environment
Global Object
Execution Context
Hoisting
Object/Functions
Function statement/Function expression
Self-invoking functions
Prototype

JavaScript (JS Advanced Part3)
Array-Helper-Methods:
forEach
map
filter
every
some
reduce






JavaScript

http://www.w3schools.com/js/default.asp

LinkedIn Learning courses:
You can find many good courses on LinkedIn Learning eg:
JavaScript Esential Training with Simon Allardice (Very basic introduction)
Introducing the JavaScript Language with Joe Chellman (Very basic introduciton)
JavaScript: Functions with Ray Villalobos (Medium)


ECMAscript, ES2015 (ES6), ES20XX

Video
JavaScript - Understanding the Weird Parts (the first 3.5 hours)
Learning ECMAScript 6 (with Eve Porcello)

Recommendation:
Udemy: JavaScript - Understanding the Weird Parts (Price ~ 14.99 euro, for the full 11 hours course)
Udemy: Javascript: Understanding ES6 and Beyond (Price ~ 14.99 euro)

New in ES2015 (ES6):
let
class
const
Arrow function "=>"
Template Literals (Template Strings) back-tick (` `) and String interpolation

ECMAscript 6 compability table

Anjana Vakil: Learning Functional Programming with JavaScript

Array-Helper-Methods:

MDN web doc, Moz://a:
forEach
map
filter
find
every
some
reduce

Notes:

JavaScriptAdvancedPart1.pptx
JavaScriptAdvancedPart2.pptx
JavaScriptAdvancedPart3.pptx
ExecutionEnvironment.docx (Word Dok in DK, Henrik H)
ArrayHelperMethods.zip (Word Dok in DK, Henrik H)


Examples (Code demonstated in the class):
Part1 - Hoisting.zip (VSCode, opdateret 07.02.23)
Part2 - Prototype.zip (VSCode, opdateret 07.02.23)

Examples/Solution (ArrayHelperMethods):
Part3 - ArrayHelperMethods.zip (VSCode)


Exercise 0:
If JavaScript is "new" to you (or you fell very rusty in JS)
Do the exercises in Codecademy:
Codecademy: https://www.codecademy.com/learn/introduction-to-javascript

Exercise 1:
Watch the video: JavaScript - Understanding the Weird Parts
(Recomandation: speed 1.25 and stop at 1:50)
Answer the questions - What is:

  • Lexical Environment vs. Execution Context?
  • The Global object?
  • this?
  • Hoisting?
  • Function invocation and Execution stack?
  • undefined?
  • "undefined" vs "not defined"?
  • "==" vs "===" when to use?

Write a short note and find some code-samples that demonstrate the term/concept

Exercise 2:
Watch the video: Learning Functional Programming with JavaScript

Look at the note: ArrayHelperMethods.zip and do the exercises:
ArrayHelperMethods.zip (Word Dok in DK)
ArrayHelperMethods.zip (Word Dok in Eng)
 


6
8/2

JavaScript ( JS Advanced Part 4)

Callbacks
Closures
Promise
Concurrency and event loop
Asynchronious callbacks
Destructuring assignment
Spread Syntax [... ]

ES2017
Async/Await



 

Video (YouTube)
Philip Roberts: What the heck is the event loop anyway? (Understanding CallBacks, 26 min)
Techsith: JavaScript callback functions (15 min)
Techsith: JavaScript promises (13 min)

Webpages:
W3Shools: JavaScript Closures
DailyJS: I-never-understood-js-closures
MDN web docs: Concurrency model and Event Loop
Async JS: From Callbacks, to Promises, to Async/Await (Blog, by Tyler McGinnis)
https://tylermcginnis.com/async-javascript-from-callbacks-to-promises-to-async-await/

Moz://a-Hacks: Destructuring
MDN web docs: Spread Syntax

Notes:
Closures og Callback functions.docx (Word Dok in DK, Henrik H)
JavaScriptAdvancedPart4.pptx

Extra material:
Kyle Simpson: Advanced Async and Concurrency Patterns in JavaScript (Promises / Generators) (Skip the first 7 min. ;))
Arindam Paul - JavaScript VM internals, EventLoop, Async and ScopeChains (38 min)

 

Examples (Code demonstated in the class):
JavaScriptAdvanced.zip (Opdateret 07.02.23)

Exercise:
ClosuresOpgaver.zip (Word Dok in DK)
PromiseOpgaver.zip (Word Dok in DK)

ClosuresExercise (Word Dok in Eng)
PromiseExercise (Word Dok in Eng)

7
15/2
React

Up and running
Components
JSX
Props
States
LifeCycle methods
EventHandlers
Request Handling async/await

Recommendation:
Udemy: Modern React with Redux [2020 update] (Price ~ 12 euro, for the full 47.5 hours course)

Video (YouTube)
Mosh: Learn React - React Crash Course 2019
Techsith: React
freeCodeCamp: Lean React.js - Full Course for Beginners - Totorials 2019

 

React
Links (React):
https://reactjs.org/
JSX In Depth
Functional vs class components in React
How to pass props to components in React
https://www.w3schools.com/react/default.asp

Note:
React.pptx

Examples (Code demonstated in the class):
(updated 13.02.23)
jsx.zip
card.zip
season.zip
pics.zip (uses axios: npm install --save-dev axios)
PicsOverview.docx

Notice:
The zip files contain only src and public folders, i.e. to run the projects you must first install the project. Unzip the project in your React folder. Open VSCode, navigate to your new project folder and install the project (type: npm install in the terminal vindow) and run the project with npm start.

Exercise:
ReactExercise1 (Basic - JSX)
ReactExercise2 (Clock)
ReactExercise3 (Movie-input-output)

Solutions: (updated 13.02.23)
Jsx.zip (ReactExercise1)
Clock.zip (ReactExercise2)
React-movie-input-output-solved.zip (ReactExercise3 - part1)
React-movie-input-output-moviedb.zip (ReactExercise3 - part2)
(som part1, men med TheMovieDb istedet for Mock-data)

8
22/2

React Redux


Note:
How to share React projects: ReactAppFiles

React Hooks (updated 03.03.23)
Build-in React Hooks: https://beta.reactjs.org/reference/react
Reducer function: https://beta.reactjs.org/learn/extracting-state-logic-into-a-reducer
Dispatch function: https://beta.reactjs.org/reference/react/useReducer#dispatch


Redux
https://redux.js.org/introduction/getting-started

Very interesting article explaining the relationship between Redux reducers and the Array-Method .reduce( ):
https://medium.com/@thejasonfile/the-redux-reducers-and-reduce-puzzle-ecc935191fbf

React Redux
https://react-redux.js.org/introduction/quick-start

Redux Toolkit
Getting started with Redux Toolkit
Usage Guide
Slices with createSlice

Examples (Code demonstated in the class):
ReactCounterAppOverview.docx (Redux JS Vanilla)
counter.zip (Redux JS Vanilla)
React-Redux-Songs-Overview.docx (React-Redux old - with connect( ) and mapStateToProps)
songs.zip (React-Redux old - with connect( ) and mapStateToProps)
react-counter-usestate-usereducer.zip (React with Hooks - useState/useReducer)


Exercise:
ReduxExercise
ReactReduxToolkitExercise1
ReactReduxToolkitExercise2

Solutions:
color.zip (ReduxExercise) (Vanilla js uden React)
redux-toolkit-counter-sol.zip (ReactReduxExercise1)
React-Redux-Count-Overview.docx
redux-toolkit-movie-sol.zip (ReactReduxExercise2)

 

 

9
1/3
React Router & Redux Thunk



Redux Toolkit - continue

React Router v6
(updated 28.02.23)
https://blog.webdevsimplified.com/2022-07/react-router/
https://reactrouter.com/en/main/start/tutorial

A Complete Guide to React Router: Everything You Need to Know (by Tyler McGinnis)
https://ui.dev/react-router-tutorial

URL Rarameters with React Router (Blog, by Tyler McGinnis)
https://ui.dev/react-router-url-parameters

Pass props to React Router's Link component (Blog, by Tyler McGinnis)
https://ui.dev/react-router-pass-props-to-link

React-Router - <NavLink>


YouTube
Learn React Router v6 In 45 Minutes

 


Redux Thunk
https://redux-toolkit.js.org/rtk-query/overview
https://daveceddia.com/what-is-a-thunk/
https://medium.com/fullstack-academy/thunks-in-redux-the-basics-85e538a3fe60

 

 

Exercise:
ReactReduxToolkitExercise3 (updated 26.02.23)

Examples
(Code demonstated in the class):

Media-AsyncThunkFunctions.zip
Media-ReduxToolkitQuery.zip

Bemærk:
For at afprøve app'en skal der oprettes et ekstra terminal-window (split)
I det ene startes json-severen med: 'npm run start:server' og i det andet vindue startes selve app'en med: 'npm start'



Exercise:

ReactRouterExercise1 (basic) (updated 28.02.23)
ReactRouterExercise2 (movie-router) (updated 28.02.23)

 

Solutions:
ReactReduxToolkitExercise3.zip (Cars) (updated 26.02.23)
ReactRouterExercise1.zip (basic) (updated 28.02.23)

 

Examples: (need to be updated - React Router v5 -> v6)
React-Redux-Router-Overview.-Movie.docx
React-Redux-Thunk-Overview.docx

Behind-the-scenes-of-Redux-Thunk.docx

Exercise:
ReduxThunkExercise1 (need to be updated - udgår!, erstattes af: RTKQueryExercise1.html )

Solutions:
ReduxThunkExercise.zip (formular1 - under construction) (need to be updated)


10
8/3
Redux-Toolkit Query (RTK-query)

Redux-Toolkit (RTK)
RTK Query

createApi: https://redux-toolkit.js.org/rtk-query/api/createApi
API Slice: https://redux-toolkit.js.org/rtk-query/api/created-api/overview

Lodash: https://lodash.com/

Exercise:
RTKQueryExercise1.html

Solutions:
movie-rtk-query.zip (TheMovieDB - RTKQueryExercise1)
11
15/3
React Project
(Mandatory Assignment Part1)
Ingen UV kun vejledning MandatoryAssignment - Part1 (React) (updated 07.03.23)
12
22/3
 

TypeScript
Anders Hejlsberg: Introducing TypeScript
Anders Hejlsberg: What's new in Typescript

TypeScript for JavaScript programmers:
https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html

The TypeScript Handbook: https://www.typescriptlang.org/docs/handbook/intro.html

Classes: https://www.typescriptlang.org/docs/handbook/2/classes.html
Objects: https://www.typescriptlang.org/docs/handbook/2/objects.html
Overloading TypeScript functions: https://visualstudiomagazine.com/articles/2015/11/01/overloading-typescript-functions.aspx
Modules (imports and exports): https://www.typescriptlang.org/docs/handbook/modules.html

Video (LinkedIn Learning)
TypeScript Essential Training with Jess Chadwick

TypeScript Playground


Understanding ES6 Modules
import
export


WebPack 2

What is Webpack?

Video (Lynda.com)
What is Webpack?






Exercise: (Install: Node + npm, Git and TypeScript)
Install Node + npm (download: https://nodejs.org/en/)
Verify that it works by running: node -v

Install Git (download: https://git-scm.com/)
Verify that it works by running: git --version

Install the TypeScript compiler globally by issuing:
npm install -g typescript
Verify the compiler works by running
tsc -v

Exercise: (Typescript)
Exercise1-TypeScript.html
Exercise2-TypeScript.html


Solutions:

Exercise1-TypeScript.zip
Exercise2-v2-typescript.zip (Updated!)

 

 

Exercise: (Webpack)
Exercise3-Webpack.html (Extra exercise - only if you have time left)

Solutions:
Exercise3-Webpack.zip (JS-Modules)


13
29/3

Angular Intro

Angular

Component interaction (Input/Output)

Routing & Navigating

Angular
Henrik Høltzer: Angular - the PIXI Book (draft - under construction)
Slides:
Angular.pptx
Introduction to Angular.ppt
Angular-Input&Output.ppt
Angular-Routing.ppt

Video (Youtube Links):
Mosh: Angular 2 Tutorial for Beginners: Learn Angular 2 from Scratch Mindspace: Angular 2 Tutorial - Complete Introduction - Angular 2 CLI Setup, ...
JavaBrains: Angular 6

Links (Angular):
angular.io: Learning Angular
angular.io: Angular Architecture overwiew

angular.io: Component interaction
angular.io: Routing&Navigation
Victor Sakin: Angular Routing


The Ultimate Angular-cli Reference

Useful List of Angular 13 Event Types for Event Binding
Why you should NEVER use Redux with Angular


Todd Motto: https://toddmotto.com/
Victor Sakin: https://vsavkin.com/


Angular Expo is a beautiful showcase of websites, applications and experiments using the Angular JavaScript framework:

Angular Expo : https://angularexpo.com/

 

Exercise: (Angular)
AngularExercise1-FirstApp.html
AngularExercise2-SimpleCalculator.html
AngularExercise3-SimpleCalculator-refactor.html
AngularExercise4-Movie-InputOutput.html
AngularExercise5-Routing.html

Solutions:
AngularExercise1-FirstApp.zip (MyFirstAngularApp)
AngularExercise2-SimpleCalculator.zip (SimpleCalculator.zip)
AngularExercise3-SimpleCalculator-refactor.zip (SimpleCalculatorV2.zip)
AngularExercise4-MovieInputOutput.zip (MovieInputOutputSolved.zip)
AngularExercise5-Routing.zip (MovieRouterSolved..zip)

Notice:

The solution zip-file don't contain the node_modules. If you want to try the solution:
1) Just unzip the file in your VSCode/Angular folder
2) Open VSCode an navigate to the new folder
3) Run: npm install in the integrated terminal window
(don't foget it takes some minuttes to generate the project).
4) Start the server by running: ng serve -o
(Don't forget to stop the server after use with: CTRL + C )

 

 

14
Påske ferie    
15
Angular Continue

Angular (continue)
Ajax & RxJS

Web-Architecture
Webservice



Links (RxJS):
Angular University - RxJS and Observables for Beginners:
https://blog.angular-university.io/functional-reactive-programming-for-angular-2-developers-rxjs-and-observables/

RxJS: http://reactivex.io/rxjs/
Andre Staltz: The introduction to Reactive Programming you've been missing
Interactive diagrams of Rx Observables: http://rxmarbles.com/
RxJS Observable - push vs pull: https://rxjs-dev.firebaseapp.com/guide/observable

RxJS Basics in Examples (Artem Diashkin)
https://medium.com/litslink/rxjs-basics-in-examples-73c3c3c415b7

Links
Enable cross-origin resource sharing
Enabling Cross-Origin Requests in ASP.NET Web API 2

Examples (Code demonstated in the class):
MovieHttpServiceRxJS.zip

MyFirstAngularApp-Overview.docx
SimpleCalculatorRefactored-Overview.docx
MovieInputOutput-Overview.docx
MovieRouter-Overview.docx
MoviesHttpServiceRxJS-Overview.docx

Exercise: (RxJS)
https://www.rxjs-fruits.com/subscribe (level 1-14)
Hint til 5 & 6: Benyt includes og substring

Exercise: (Angular)
AngularExercise6-HttpService.html

 

Solutions:
AngularExercise6-HttpService.zip (F1SimpleHttpService.zip)

Notice:
If you are using Crome and have your webservice on your localhost, the "same origin policy" prohibits you accessing your data. You can disable the same origin policy on Google's Chrome browser by closing Chrome an open it from the cmd with: --disable-web-security (C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --disable-web-security - on my computer)
see: stackoverflow: disable same origin policy in chrome

or install: Allow-Control-Allow-Origin: *

 

16 Angular Project
(Mandatory Assignment Part2)
Supervision Mandatory assigment - Part 2 (React el. Angular - Opdateret d. 27/03/2023)
Notice:
The Assignment has to be approved by me in the Class or by MS Teams, no later than Wednesday, April 19, 2023 at 14:45.
17-21 Synopsis

Specialization in one of your electives
The report must be handed in no later than Thursday 1. June 2023 at 12.00 in Wiseflow

Synopsisdescription
Synopsis ideas

Supervision - Booking Sheets

23-24 Exam: 8 or 9 or 12 june 2023 Examination meetinglist  

 

Extra materials:

Responsive web design (RWD)

Bootstrap 4

Responsive Web Design (RWD)
Ethan Marcotte: A List Apart
In this article, from May 2010, Ethan Marcotte define the term “Responsive Web Design” for the first time – he cited fluid grids, flexible images, and media queries as three “technical ingredients” of RWD.

Kezz Bracey: The State of Responsive Web Design
In this article, from Jan 2015, Kezz Bracey give an up-to-date description of “Responsive Web Design”.

More to read about RWD:
This Is Responsive There you can find responsive design patterns, more responsive resources, and responsive news.

Mediaqueri  There you’ll find a huge showcase of responsive websites (perfect if you need some inspiration).


Bootstrap
Links (Bootstrap):
Bootstrap: http://getbootstrap.com/
How to add a Navigation bar to your app:
https://www.youtube.com/watch?v=23bpce-5s8I ( Bootstrap 4 Navbar Concepts ) NEW!



Free themes for Bootstrap
Bootstrap CDN: http://www.bootstrapcdn.com/#bootswatch_tab

W3schools: Bootstrap get started
http://www.lynda.com/Bootstrap-training-tutorials/1421-0.html

Google
Test tool: Mobile-friendly Test

Examples (Code demonstated in the class):
BootstrapTest.zip (Bootstrap 3 - VSCode)
Bootstrap4Test.zip (Bootstrap 4 - VSCode)
BootstrapLynda.zip(VSCode)


Examples
(Responsive and not Responsive):
A good responsive website (New York Times)
https://www.youtube.com/watch?v=YRZqSKp71mI

 

Exercise: (Lynda.com)
Bootstrap 4: Essential Training with Ray Villalobos
Watch the video, redo the demonstrated stuff and do the Challenge.




More about: HTML/CSS/JS

HTML:
30 Must-See HTML5 tutorials ...
HTML CSS BOOK

HTML5 Video player: http://videojs.com/
HTML Video Tutorial: http://www.mrc-productivity.com/techblog/?p=722
HTML5 Geolocation: http://www.mrc-productivity.com/techblog/?p=714
HTML5 Canvas: http://www.mrc-productivity.com/techblog/?p=718

CSS:
CSS Selectors: Class vs ID: http://www.tizag.com/cssT/cssid.php

CSS-Grid (Layout with Grid and Media-Queries)
MDN: Grid template areas
MDN: Realizing common layouts using CSS Grid Layout
Tony Thomas: A Beginners Guide to CSS Grid Layout

 

JavaScript:
Webucators JavaScript Tutorial: http://www.learn-javascript-tutorial.com/
JavaScript cheat-sheet: http://firstsiteguide.com/javascript-cheat-sheet/

Debugging JavaScript
Chrome DevTools (Ctrl Shift I)

JavaScript Debugging:
http://www.w3schools.com/js/js_debugging.asp


Object Oriented JavaScript
Introduction to Object-Oriented JavaScript

JavaScript Objects
http://www.w3schools.com/js/js_objects.asp
http://www.w3schools.com/js/js_object_definition.asp


JavaScript Hoisting
https://www.w3schools.com/js/js_hoisting.asp

 

 

 

DOM4: W3C Recommendation 19 November 2015
https://www.w3.org/TR/dom/

What is the DOM:
https://developer.mozilla.org/en-US/docs/Gecko_DOM_Reference/Introduction#What_is_the_DOM.3F

 
  NPM (Node Package Manager)
Video (Lynda.com)
Up and Running with NPM with Ray Villalobos

Kennedy, Hugh; DeVay, Paul
"Understanding npm"Nsight. Retrieved 22 July 2016
 
  Asynchronous Programming:
https://egghead.io/courses/mastering-asynchronous-programming-the-end-of-the-loop

ReactJS
Lynda.com:
Learn React.js: The Basics with Eve Porcello
Building a Web Interface with React.j with Ray Villalobos

RxJS
Reactive extensions for JS (RxJS) and reactive programming
 
Extra
JQuery

JQuery
Links (JQuery):
http://jquery.com/
http://jqueryui.com/

jQuery.com Tutorial:
http://try.jquery.com/

W3Schools JQuery Tutorial:
http://www.w3schools.com/jquery/

JQuery Tutorial / Best practice
http://www.learn-jquery-tutorial.com/BestPractices.cfm#.USx5vB1WySp

Lynda.com:
http://www.lynda.com/jQuery-tutorials/jQuery-Essential-Training/183382-2.html


Slides:

JQuery.ppt
Codeschool_try_jquery.pdf
JQuery-essentials-slideshow

Examples (Code demonstated in the class):
JQuerySelectTest.zip (VSCode)


Exercise:
Do the tutorial at TRYjQuery: http://try.jquery.com/
Do the tutorial at CodeCademy: https://www.codecademy.com/courses/web-beginner-en-bay3D/2/1
  Extra material (if you want to go futher with MEAN and/or FireBase)

NodeJS
Introduction to Node with Ryan Dahl

Lynda.com:
Up and Running with Node.js with Alexander Zanfir
Building a Website with Node.js and Express.js  with Ray Villalobos
Node.js Essential Training with Alex Banks

MongoDB
https://www.mongodb.org/
MVA: You've Got Documents! A MongoDB Jump Start
Code School: The Magical Marvels of MongoDB

MEAN
Code School: Become a MEAN Stack Developer

FireBase
https://firebase.google.com/
https://www.youtube.com/user/Firebase?hl=da
 
 

TypeScript
Anders Hejlsberg: Introducing TypeScript
Anders Hejlsberg: What's new in Typescript
Classes: http://www.typescriptlang.org/docs/handbook/classes.html
Interfaces: https://www.typescriptlang.org/docs/handbook/interfaces.html
Overloading TypeScript functions: https://visualstudiomagazine.com/articles/2015/11/01/overloading-typescript-functions.aspx
Modules (imports and exports): https://www.typescriptlang.org/docs/handbook/modules.html

Video (Lynda.com)
Essential Training with Jess Chadwick


TypeScript Playground


Understanding ES6 Modules
import
export


WebPack 2

What is Webpack?

Video (Lynda.com)
What is Webpack?






Exercise: (Install: Node + npm, Git and TypeScript)
Install Node + npm (download: https://nodejs.org/en/)
Verify that it works by running: node -v

Install Git (download: https://git-scm.com/)
Verify that it works by running: git --version

Install the TypeScript compiler globally by issuing:
npm install -g typescript
Verify the compiler works by running
tsc -v

Exercise: (Typescript)
Exercise1-TypeScript.html
Exercise2-TypeScript.html


Solutions:

Exercise1-TypeScript.zip
Exercise2-TypeScript.zip

 

 

Exercise: (Webpack)
Exercise3-Webpack.html (Extra exercise - only if you have time left)

Solutions:
Exercise3-Webpack.zip (JS-Modules)