File tree 1 file changed +3
-5
lines changed
documentation/docs/02-runes 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,15 @@ todos[0].done = !todos[0].done;
67
67
68
68
### Classes
69
69
70
- You can also use ` $state ` in class fields (whether public or private):
70
+ You can also use ` $state ` in class fields (whether public or private), or as the first assignment to a property immediately inside the ` constructor ` :
71
71
72
72
``` js
73
73
// @errors: 7006 2554
74
74
class Todo {
75
75
done = $state (false );
76
- text = $state ();
77
76
78
77
constructor (text ) {
79
- this .text = text;
78
+ this .text = $state ( text) ;
80
79
}
81
80
82
81
reset () {
@@ -110,10 +109,9 @@ You can either use an inline function...
110
109
// @errors: 7006 2554
111
110
class Todo {
112
111
done = $state (false );
113
- text = $state ();
114
112
115
113
constructor (text ) {
116
- this .text = text;
114
+ this .text = $state ( text) ;
117
115
}
118
116
119
117
++ + reset = () => {++ +
You can’t perform that action at this time.
0 commit comments