Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,570 --> 00:00:07,470
In this lecture, we're going to learn how to verify if a variable is reactive, the composition API
2
00:00:07,470 --> 00:00:09,690
is meant for very large components.
3
00:00:09,960 --> 00:00:16,170
Somewhere along the line, it's possible to run into errors and error because a variable is no longer
4
00:00:16,170 --> 00:00:16,890
reactive.
5
00:00:17,070 --> 00:00:22,380
If we lose reactivity, our application may not behave as users may expect.
6
00:00:23,010 --> 00:00:29,370
You provide two functions for verifying if a variable is reactive, they can be useful and debugging
7
00:00:29,370 --> 00:00:30,290
an application.
8
00:00:30,600 --> 00:00:31,930
Let's look at both of them.
9
00:00:32,159 --> 00:00:37,950
Currently, I'm in the first project we were working with when learning about the composition API.
10
00:00:38,250 --> 00:00:42,030
Specifically, I have the numbers just file opened.
11
00:00:44,510 --> 00:00:51,650
The View package has two functions called is rough and is reactive, let's include both of them with
12
00:00:51,650 --> 00:00:52,700
the important statement.
13
00:00:55,280 --> 00:01:01,460
The is Reft function can be used for checking if a variable is reactive that was created with the rev
14
00:01:01,460 --> 00:01:08,090
function, whereas the is reactive function will check if a variable is reactive that was created with
15
00:01:08,090 --> 00:01:09,400
the reactive function.
16
00:01:10,070 --> 00:01:15,740
We're going to update the import statement to include the reactive function because we'll need to create
17
00:01:15,740 --> 00:01:19,010
a variable with this function for demonstration purposes.
18
00:01:21,570 --> 00:01:26,580
Next, and he said function will quickly create an object called accounts.
19
00:01:29,180 --> 00:01:32,930
This object will be created with the reactive function we imported.
20
00:01:35,220 --> 00:01:40,110
It'll have two properties called checking and savings with random values.
21
00:01:42,730 --> 00:01:48,490
The reason we're creating this object is because we want to be able to test the is reactive function,
22
00:01:48,920 --> 00:01:52,750
our numbers look function didn't have any reactive variables.
23
00:01:53,140 --> 00:01:57,850
After creating the accounts, Variable will perform a log to the console.
24
00:02:00,610 --> 00:02:07,240
They long will output the return value by the IS Reft function will pass and the NUM variable to the
25
00:02:07,240 --> 00:02:08,350
is Reft function.
26
00:02:10,990 --> 00:02:17,590
Will create another log, but this time will log the return value by the is reactive function with the
27
00:02:17,590 --> 00:02:18,760
accounts variable.
28
00:02:21,400 --> 00:02:25,490
Both lungs should output true, since both variables are reactive.
29
00:02:25,750 --> 00:02:29,550
We didn't change them, so they shouldn't have lost their reactivity.
30
00:02:29,950 --> 00:02:33,400
Let's refresh the page in the browser with the console opened.
31
00:02:36,110 --> 00:02:42,230
Both functions are returning true, this means our variables are reactive, the issue provides both
32
00:02:42,230 --> 00:02:47,710
functions for testing f our code is reactive, it's useful for debugging and application.
33
00:02:48,020 --> 00:02:53,150
If you were to override a reactive variable completely, you will lose that reactivity.
34
00:02:53,750 --> 00:02:59,660
That may happen since we're not using the options API where we may accidentally lose reactivity.
35
00:02:59,930 --> 00:03:03,420
Other than that, these two functions don't have much use.
36
00:03:03,800 --> 00:03:05,960
That wraps it up for these two functions.
37
00:03:06,170 --> 00:03:07,550
I'll see you in the next one.
3918
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.