Skip to content

Commit ec1a9bf

Browse files
committed
styles, optimistic fix
1 parent b406dbc commit ec1a9bf

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

lessons/07-optimistic-values/A-what-are-optimistic-values.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ description: >-
33
Discover the concept of optimistic UI updates in messaging apps, where the
44
user interface reflects message sending before the actual network send,
55
enhancing user experience. This approach, explained by Brian Holt in the
6-
Intermediate React v6 course, utilizes hooks like useOptimisticValue and
6+
Intermediate React v6 course, utilizes hooks like useOptimistic and
77
useTransition to efficiently manage state changes in React applications.
88
keywords:
99
- optimistic UI
1010
- React
1111
- Brian Holt
12-
- useOptimisticValue
12+
- useOptimistic
1313
- useTransition
1414
---
1515

@@ -23,4 +23,4 @@ Let's say you are texting your friend. You open iMessage, WhatsApp, Signal, ICQ,
2323

2424
That #3 is interesting - you get visual feedback in your log of messages as if the message was already sent. In your mind, the message is sent, and the UI reflects that. In reality the message hasn't even left the device when it's first rendered that way, so in some ways it's a bit misleading, but this **optimistic** display of UI is more closely reflects the user's mental model.
2525

26-
That's what we're talking about, optimistic UI updates - we're doing some backend work behind the scenes, but we're going to optimistically show the user that their update was done. This is possible to do without the ready-made hook `useOptimisticValue` but it was such a pain before. Now it's fairly easy to use in conjunction with useTransition (necessary to identify a low priority re-render) to show an intermediary state.
26+
That's what we're talking about, optimistic UI updates - we're doing some backend work behind the scenes, but we're going to optimistically show the user that their update was done. This is possible to do without the ready-made hook `useOptimistic` but it was such a pain before. Now it's fairly easy to use in conjunction with useTransition (necessary to identify a low priority re-render) to show an intermediary state.

lessons/07-optimistic-values/B-the-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function App() {
9898
- Nothing surprising here. We get thoughts on load, and we reload them on POST
9999
- The big issue here is that the user is shown no feedback while the POST happening.
100100
- We could just append to thoughts and hope for the best - and this is what we used to do.
101-
- However we can use `useOptimisticState` and get a lot of the error cases and other problems wrapped up and taken care of for us.
101+
- However we can use `useOptimistic` and get a lot of the error cases and other problems wrapped up and taken care of for us.
102102
103103
[starter]: https://github.com/btholt/irv6-project/tree/main/starter/optimistic
104104
[completed]: https://github.com/btholt/irv6-project/tree/main/completed/optimistic

lessons/07-optimistic-values/C-optimistic-values.md renamed to lessons/07-optimistic-values/C-useOptimistic-Hook.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
---
2+
title: "useOptimistic Hook"
23
description: >-
34
Discover how optimistic UI updates in messaging apps like iMessage or WhatsApp
45
give users immediate visual feedback before a message is truly sent. Learn
56
with Brian Holt in the Intermediate React v6 course for Frontend Masters,
6-
focusing on using React Server Components and hooks like useOptimisticValue
7+
focusing on using React Server Components and hooks like useOptimistic
78
and useTransition for seamless web development.
89
keywords:
910
- optimistic UI
1011
- React
11-
- useOptimisticValue
12+
- useOptimistic
1213
- useTransition
1314
- Brian Holt
1415
- Frontend Masters
1516
- web development
1617
---
17-
Let's refactor to use transitions and `useOptimisticValue`.
18+
19+
Let's refactor to use transitions and `useOptimistic`.
1820

1921
```javascript
2022
// at the top

styles/courses.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,17 @@ body {
3636

3737
a {
3838
color: var(--text-links);
39-
text-decoration: none;
39+
text-underline-offset: 2px;
40+
}
41+
42+
43+
/*
44+
Thanks Chris Coyier
45+
https://frontendmasters.com/blog/chilled-out-text-underlines/
46+
*/
47+
a:not(:is(:hover, :focus)) {
48+
text-decoration-color:
49+
color-mix(in srgb, currentColor, transparent 75%);
4050
}
4151

4252
.navbar {
@@ -262,6 +272,13 @@ header .cta-btn {
262272
padding: 15px 0;
263273
}
264274

275+
.lesson-details a,
276+
.navbar-brand a,
277+
.navbar-info a,
278+
.lesson-links a {
279+
text-decoration: none;
280+
}
281+
265282
.lesson li li {
266283
margin-left: 25px;
267284
}

styles/variables.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
--text-header: var(--primary);
77
--text-main-headers: var(--highlight);
8-
--text-links: #00ca22;
8+
--text-links: #006711;
99
--text-footer: var(--highlight);
1010

1111
--bg-main: black;

0 commit comments

Comments
 (0)