-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4.html
132 lines (117 loc) · 4.54 KB
/
4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Advanced Web Dev</title>
<meta name="author" content="Eric Moynihan" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="reveal/css/reset.css" />
<link rel="stylesheet" href="reveal/css/reveal.css" />
<link rel="stylesheet" href="reveal/css/theme/black.css" id="theme" />
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal/lib/css/monokai.css" />
<!-- Printing and PDF exports -->
<script>
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = window.location.search.match(/print-pdf/gi)
? "reveal/css/print/pdf.css"
: "reveal/css/print/paper.css";
document.getElementsByTagName("head")[0].appendChild(link);
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<img src="https://cdn-assets-cloud.frontify.com/local/frontify/h_lNxVXLqrDqb2kyrixW3lMmUl7n-aBRzJUzyvzD7_9FpVMt61zcnJ81BDOqdkOndY8i0eAwn6Wh0ML1aAgbhjOhufnBG8Tz7OVGBhGqrknPlL9fOTjbQj2eRqycd0zF?width=2400" style="border: 0; background: transparent; width: 35%;" />
<h1>Advanced Web Development</h1>
<p><b>Week 4</b>: React</p>
<p>By <a href="https://github.com/ericm">Eric Moynihan</a></p>
</section>
<section style="text-align: left;">
<h1>React</h1>
<p>React is a UI JavaScript framework. It runs on the client and allows us to make reusable UI components with individual or shared state.</p>
<p>React uses a superset of JavaScript called JSX to handle it's components</p>
</section>
<section style="text-align: left;">
<h1>JSX</h1>
<p>JSX is just ES6 Javascript but also supports XML (HTML is based on XML)</p>
<p>This allows React to use HTML elements as objects and you can construct a React component using JSX</p>
</section>
<section style="text-align: left;">
<h2>Example</h2>
<pre><code class="hljs">
import * as React from "react";
import { render } from "react-dom"
class ShoppingList extends React.Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for {this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
</div>
);
}
}
let baseDiv = document.querySelector("#root");
// Note the this.props.name.
// We can pass that prop during construction as below
// Props in react are just attributes on the element
// Below is the render function from react-dom
// It injects a react component into a component in the regular dom.
render(<ShoppingList name="Whatever"></ShoppingList>, baseDiv)
</code></pre>
</section>
<section>
<h1>Note</h1>
<p>The JSX isnt sent to the client. It's transpiled to normal JavaScript when you build the project.</p>
</section>
</div>
</div>
<script src="reveal/js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
center: true,
hash: true,
transition: "slide", // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{
src: "reveal/plugin/markdown/marked.js",
condition: function() {
return !!document.querySelector("[data-markdown]");
}
},
{
src: "reveal/plugin/markdown/markdown.js",
condition: function() {
return !!document.querySelector("[data-markdown]");
}
},
{ src: "reveal/plugin/highlight/highlight.js", async: true },
{ src: "reveal/plugin/search/search.js", async: true },
{ src: "reveal/plugin/zoom-js/zoom.js", async: true },
{ src: "reveal/plugin/notes/notes.js", async: true }
]
});
</script>
</body>
</html>