From e265d825400de2e46214c8cd7245a5ff8f3b807d Mon Sep 17 00:00:00 2001 From: Elder <130733914+lian125537@users.noreply.github.com> Date: Fri, 24 Jul 2026 03:36:53 +0800 Subject: [PATCH] docs: improve README --- README.md | 109 +----------------------------------------------------- 1 file changed, 2 insertions(+), 107 deletions(-) diff --git a/README.md b/README.md index 880b18ed..e564be14 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,6 @@ # ReactFire -Hooks, Context Providers, and Components that make it easy to interact with -Firebase. - -## What is ReactFire? - -- **Easy realtime updates for your function components** - Hooks - like `useUser`and `useFirestoreCollection` let you easily subscribe to - auth state, realtime data, and all other Firebase SDK events. Plus, they automatically unsubscribe when your component unmounts. -- **Access Firebase libraries from any component** - Need the Firestore SDK? `useFirestore`. Remote Config? `useRemoteConfig`. -- **Safely configure Firebase libraries** - Libraries like Firestore and Remote Config require settings like `enablePersistence` to be set before any data fetches are made. This can be tough to support in React's world of re-renders. ReactFire gives you `useInitFirestore` and `useInitRemoteConfig` hooks that guarantee they're set before anything else. - -## Platform support - -ReactFire is designed for **web React apps** and wraps the [Firebase Web SDK](https://firebase.google.com/docs/web/setup). It is not compatible with React Native or Expo. For React Native projects, use [react-native-firebase](https://rnfirebase.io/) instead. - -## Install - -```bash -# npm -npm install --save firebase reactfire - -# or - -# yarn -yarn add firebase reactfire -``` - -Depending on your targeted platforms you may need to install polyfills. The most commonly needed will be [globalThis](https://caniuse.com/#search=globalThis) and [Proxy](https://caniuse.com/#search=Proxy). - -## Docs - -- [**Quickstart**](./docs/quickstart.md) -- [**Common Use Cases**](./docs/use.md) -- [**API Reference**](./docs/reference) -- [**v3 -> v4 Upgrade Guide**](./docs/upgrade-guide.md) - -## Example use - -Check out the -[live version on StackBlitz](https://stackblitz.com/fork/reactfire-v4-sample)! - -```jsx -import React from 'react'; -import { render } from 'react-dom'; - -import { doc, getFirestore } from 'firebase/firestore'; -import { FirebaseAppProvider, FirestoreProvider, useFirestoreDocData, useFirestore, useFirebaseApp } from 'reactfire'; - -const firebaseConfig = { - /* Add in your config object from the Firebase console */ -}; - -function BurritoTaste() { - // access the Firestore library - const burritoRef = doc(useFirestore(), 'tryreactfire', 'burrito'); - - // subscribe to a document for realtime updates. just one line! - const { status, data } = useFirestoreDocData(burritoRef); - - // check the loading status - if (status === 'loading') { - return
Fetching burrito flavor...
; - } - - returnThe burrito is {data.yummy ? 'good' : 'bad'}!
; -} - -function App() { - const firestoreInstance = getFirestore(useFirebaseApp()); - return ( -