react-firebase-ql 0.2.0 → 1.0.0
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/README.md +11 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,22 +93,22 @@ export enum FIREBASETABLE {
|
|
|
93
93
|
---
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
|
-
##
|
|
96
|
+
## Creating Models
|
|
97
97
|
|
|
98
98
|
Organize your models in a dedicated folder
|
|
99
99
|
src/ or app/ - for nextjs developers
|
|
100
100
|
|
|
101
|
+
```css
|
|
101
102
|
src/
|
|
102
|
-
|
|
103
103
|
└── models/
|
|
104
|
-
|
|
105
|
-
├── Users.model.ts
|
|
106
|
-
|
|
104
|
+
├── Users.model.ts
|
|
107
105
|
├── Posts.model.ts
|
|
108
|
-
|
|
109
106
|
└── ...other models
|
|
110
|
-
|
|
111
107
|
```
|
|
108
|
+
|
|
109
|
+
## Example: Users Model
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
112
|
// src/models/Users.model.ts
|
|
113
113
|
import { firestoreDB } from "../firebase.config";
|
|
114
114
|
import { FIREBASETABLE } from "../firebase.config";
|
|
@@ -119,6 +119,7 @@ export interface YourFirestoreDocumentStructure {
|
|
|
119
119
|
firstName: string;
|
|
120
120
|
---
|
|
121
121
|
}
|
|
122
|
+
|
|
122
123
|
export class UsersModel extends BaseModel {
|
|
123
124
|
|
|
124
125
|
data: YourFirestoreDocumentStructure | YourFirestoreDocumentStructure[] | undefined;
|
|
@@ -136,10 +137,10 @@ export class UsersModel extends BaseModel {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
```
|
|
140
|
+
## Using Hooks
|
|
141
|
+
Fetch a single user record by reference
|
|
139
142
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
+
```ts
|
|
143
144
|
import { useFetch } from "react-firebase-ql";
|
|
144
145
|
import { UsersModel } from "../models/Users.model";
|
|
145
146
|
|
|
@@ -161,13 +162,6 @@ export default function UserProfile() {
|
|
|
161
162
|
|
|
162
163
|
```
|
|
163
164
|
|
|
164
|
-
## Acknowledgements
|
|
165
|
-
|
|
166
|
-
- [Awesome Readme Templates](https://awesomeopensource.com/project/elangosundar/awesome-README-templates)
|
|
167
|
-
- [Awesome README](https://github.com/matiassingers/awesome-readme)
|
|
168
|
-
- [How to write a Good readme](https://bulldogjob.com/news/449-how-to-write-a-good-readme-for-your-github-project)
|
|
169
|
-
|
|
170
|
-
Breedware Limited
|
|
171
165
|
## Authors
|
|
172
166
|
|
|
173
167
|
- [@breedware](https://www.github.com/breedware)
|
package/package.json
CHANGED