You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-4Lines changed: 50 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Build Vue-like components in React (watch, computed & no more setState)
6
6
7
7
`$ npm install --save-dev react-vue-component`
8
8
9
-
# Usage
9
+
# Basic Usage
10
10
11
11
-```jsx
12
12
import {Component} from"react-vue-component";
@@ -16,7 +16,7 @@ Build Vue-like components in React (watch, computed & no more setState)
16
16
name:"Bob",
17
17
}
18
18
mounted() {
19
-
19
+
this.name="Albert";
20
20
}
21
21
watch {
22
22
name(newName, oldName) {
@@ -30,11 +30,14 @@ Build Vue-like components in React (watch, computed & no more setState)
30
30
}
31
31
methods {
32
32
changeName() {
33
-
this.name="John"; // Changing name will also change the computed property fullName
33
+
// Changing name will also change the computed property fullName
34
+
this.name="John";
34
35
}
35
36
}
36
37
render() {
37
-
const {name, obj} =this; // states, methods, and computed properties can be accessed directly via `this` just like in Vue
38
+
// states, methods, and computed properties can be accessed directly via `this` just like in Vue
39
+
const {name, fullName, changeName} =this;
40
+
38
41
return (
39
42
<div>
40
43
<p>{name}</p>
@@ -45,3 +48,46 @@ Build Vue-like components in React (watch, computed & no more setState)
45
48
}
46
49
}
47
50
```
51
+
52
+
## Objects
53
+
54
+
- In Vue, in order to "reactively" add/delete key-value pairs from an object, you will need to use `set(obj, key, value)`and `delete(obj,key)`respectively.
0 commit comments