-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnovember_19.html
72 lines (66 loc) · 3.82 KB
/
november_19.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
<!DOCTYPE html>
<html>
<head>
<title>Jarod Reichel's Web Dev Blog</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Exo&family=Roboto&display=swap" rel="stylesheet">
<link href="styles.css" rel="stylesheet">
</head>
<body>
<header>
<h1>CS 347 Blog Entry - November 19, 2021</h1>
</header>
<main>
<h2>Part I: React Memo</h2>
<p>When using a React Component, sometimes its props will not change, yet the component will be Re-Rendered by the browser, which especially with larger, more complex components, can result in performance deficits. This issue can be resolved by using a hook called <span class="code_inline">useMemo</span>, which makes a react component re-render only if its props have changed.</p>
<h3>index.js</h3>
<pre>
import { useState } from "react";
import ReactDOM from "react-dom";
import Todos from "./Todos";
const App = () => {
const [count, setCount] = useState(0);
const [todos, setTodos] = useState(["todo 1", "todo 2"]);
const increment = () => {
setCount((c) => c + 1);
};
return (
<>
<Todos todos={todos} />
<hr />
<div>
Count: {count}
<button onClick={increment}>+</button>
</div>
</>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
</pre>
<h3>Todos.js</h3>
<pre>
const Todos = ({ todos }) => {
console.log("child render");
return (
<>
<h2>My Todos</h2>
{todos.map((todo, index) => {
return <p key={index}>{todo}</p>;
})}
</>
);
};
export default Todos;
</pre>
<p>The above code and information was sourced from <a href="https://www.w3schools.com/react/react_memo.asp">W3Schools.com</a>.</p>
<h2>Part II: Other Web Development Frameworks</h2>
<p>For the final few blog entries, I will be going over various other Web Frameworks, including server-side or Backend frameworks like Express, front-end frameworks like React, as well as introducing some full-stack frameworks that provide both a front and backend solution.</p>
<p>While React is one of the most popular JavaScript-based front-end frameworks, alternatives such as Angular and Vue also exist, each with varying features and structures. In addition, server-side frameworks in various other languages can be used for varying complexities of web services. For example, Ruby on Rails, built on top of the Ruby language, is a popular server-side framework. Also, Microsoft's ASP.NET, built on C#, is a somewhat popular solution for some larger-scale web apps and services. In addition, Next.js is a JavaScript-based framework that adds server-side rendering functionality to React apps.</p>
<p>The above information on various frameworks was sourced from <a href="https://en.wikipedia.org/wiki/Comparison_of_server-side_web_frameworks">Wikipedia</a>.</p>
</main>
<footer>
<p>Site by Jarod Reichel</p>
</footer>
</body>
</html>