Git Product home page Git Product logo

Comments (4)

chrisbianca avatar chrisbianca commented on May 20, 2024 3

I've just been having a play around with this and have got something working which will be part of the upcoming v3 of the library. I'm aiming to have this released in the next week or 2.

For reference, the syntax is:

const [value, loading, error] = useCollectionData<MyObject, 'idFieldName', 'refFieldName'>(...)

from react-firebase-hooks.

chrisbianca avatar chrisbianca commented on May 20, 2024 1

This has now been released in https://github.com/CSFrequency/react-firebase-hooks/releases/tag/v3.0.1

from react-firebase-hooks.

maxtotheguenther avatar maxtotheguenther commented on May 20, 2024

Totally agree with @cdoe .
Currently im solving this issue with:

export default function useSnapshot<T>(query?: firestore.Query | null | undefined, options?: {
    snapshotListenOptions?: firestore.SnapshotListenOptions | undefined;
} | undefined): [IGeneric<T>[] | undefined, firestore.QuerySnapshot | undefined, boolean, Error | undefined] {
    const [value, loading, error] = useCollection(query, options)
    const model = value && value.docs.map(val => {
        const data = val.data() as T
        const model: IGeneric<T> = {
            uid: val.id,
            data
        }
        return model
    })
    return [model, value, loading, error];
`

from react-firebase-hooks.

laurensnl avatar laurensnl commented on May 20, 2024

+1 This should definitely be in there. Does anyone have any idea how to achieve this?

from react-firebase-hooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.