Skip to content

Feature: Allow an initial value to be returned by the hooks  #190

@dylanwatsonsoftware

Description

@dylanwatsonsoftware

In NextJS the idea is that you preload the data at build time. This then gets passed to your component via props.

If I have a component that uses say useCollectionData, it would be useful to specify an initial value that the hook should return whilst the data is loading. As soon as the firebase query has loaded, this value would be ignored and replaced with the value from the firebase query.

It is currently possible to do this outside of the firebase hook but it's a little awkward and this would really simplify the code for this usecase (i.e any nextjs project)

I think it'd be a pretty simple change so happy to put up a PR if you'd be interested in accepting a feature like this.

Thanks,
Dylan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions