-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathpackage-use-fireproof.json
38 lines (38 loc) · 1.98 KB
/
package-use-fireproof.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"name": "use-fireproof",
"version": "must-set",
"description": "Fireproof live ledger, JavaScript API and React hooks",
"type": "module",
"module": "./index.js",
"main": "./index.cjs",
"browser": "./index.global.js",
"types": "./index.d.ts",
"homepage": "https://use-fireproof.com",
"repository": {
"type": "git",
"url": "git+https://github.com/fireproof-storage/fireproof.git"
},
"bugs": {
"url": "https://github.com/fireproof-storage/fireproof/issues"
},
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs",
"script": "./index.global.js",
"types": "./index.d.ts"
}
},
"scripts": {},
"author": "J Chris Anderson",
"license": "Apache-2.0 OR MIT",
"gptdoc": "Fireproof/React/Usage: import { useFireproof } from 'use-fireproof'; function WordCounterApp() { const { useLiveQuery, useDocument } = useFireproof('my-word-app'); const { doc: wordInput, merge: updateWordInput, save: saveWordInput, reset: clearWordInput } = useDocument({ word: '', timestamp: Date.now() }); const recentWords = useLiveQuery('timestamp', { descending: true, limit: 10 }); const { doc: { totalSubmitted }, merge: updateTotalSubmitted, save: saveTotalSubmitted } = useDocument({ _id: 'word-counter', totalSubmitted: 0 }); const handleWordSubmission = (e) => { e.preventDefault(); updateTotalSubmitted({ totalSubmitted: totalSubmitted + 1 }); saveTotalSubmitted(); saveWordInput(); clearWordInput();}; return (<><p>{totalSubmitted} words submitted</p><form onSubmit={handleWordSubmission}><input type='text' value={wordInput.word} onChange={e => updateWordInput({ word: e.target.value })} placeholder='Enter a word' /></form><ul>{recentWords.docs.map(entry => (<li key={entry._id}>{entry.word}</li>))} </ul></>) } export default WordCounterApp;",
"dependencies": {
"@fireproof/core": "from-package-json"
},
"peerDependencies": {
"react": ">=18.0.0!"
},
"devDependencies": {},
"keywords": ["react", "ledger", "json", "live", "sync"]
}