react-rock 3.1.5 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-rock",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"author": "Naxrul Ahmed",
|
|
5
5
|
"description": "React-Rock is a modern, lightweight state management library designed to simplify handling global state in React applications. With a minimal API and powerful features like freezing data updates for optimized re-renders, React-Rock allows you to manage state more efficiently while ensuring your app remains fast and responsive.",
|
|
6
6
|
"main": "./index.js",
|
package/readme.md
CHANGED
|
@@ -83,7 +83,7 @@ Here’s a table with all available methods and their descriptions:
|
|
|
83
83
|
The `find` method allows you to search for rows in the store based on specific conditions:
|
|
84
84
|
|
|
85
85
|
```typescript
|
|
86
|
-
const foundUsers = users.find({ name:
|
|
86
|
+
const foundUsers = users.find({ name: 'John Doe' } });
|
|
87
87
|
console.log(foundUsers);
|
|
88
88
|
```
|
|
89
89
|
|
|
@@ -157,10 +157,10 @@ class UserList extends StoreComponent {
|
|
|
157
157
|
users.create({ name: 'Alice', age: 25 });
|
|
158
158
|
|
|
159
159
|
// Update a user
|
|
160
|
-
users.update({ age: 26 }, { name:
|
|
160
|
+
users.update({ age: 26 }, { name: 'Alice' } });
|
|
161
161
|
|
|
162
162
|
// Delete a user
|
|
163
|
-
users.delete({ name:
|
|
163
|
+
users.delete({ name: 'Alice' } });
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
## Examples with `find` and Query
|
|
@@ -171,7 +171,7 @@ const usersOver25 = users.find({ age: { gt: 25 } });
|
|
|
171
171
|
console.log(usersOver25);
|
|
172
172
|
|
|
173
173
|
// Find the first user with the name 'Alice'
|
|
174
|
-
const alice = users.findFirst({ name:
|
|
174
|
+
const alice = users.findFirst({ name: 'Alice' } });
|
|
175
175
|
console.log(alice);
|
|
176
176
|
```
|
|
177
177
|
|
|
@@ -184,7 +184,7 @@ import { StoreComponent } from 'react-rock';
|
|
|
184
184
|
|
|
185
185
|
class UserList extends StoreComponent {
|
|
186
186
|
render() {
|
|
187
|
-
const users =
|
|
187
|
+
const users = users.getAll();
|
|
188
188
|
return (
|
|
189
189
|
<div>
|
|
190
190
|
{users.map(user => <div key={user._id}>{user.name}</div>)}
|
|
@@ -195,7 +195,7 @@ class UserList extends StoreComponent {
|
|
|
195
195
|
|
|
196
196
|
class UserProfile extends StoreComponent {
|
|
197
197
|
render() {
|
|
198
|
-
const user =
|
|
198
|
+
const user = users.findFirst({ name: 'John Doe' });
|
|
199
199
|
return <div>{user ? user.name : 'User not found'}</div>;
|
|
200
200
|
}
|
|
201
201
|
}
|