1.0.8 • Published 10 months ago

@datagee/elements v1.0.8

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

Elements by Datagee (Beta)

Software engineering elements for forward-thinking developers.

Platforms

React Native, React Native Web

Installation

yarn add @datagee/elements

Usage

Implement authentication and a cloud database

Using Firestore:

Securely store your firebase configuration details object and import that into your component. How you do this depends on your project and build settings.

For most users, storing the configuration in a file and adding it to your .gitignore is a sufficient configuration. Assuming you have an object like:

    firebaseConfig = {
        apiKey: "your_api_key",
        authDomain: ...,
        ...
    }

Easily add cloud services to your project like this:

import React, {
    useEffect,
    useState,
} from "react"

import {
    DGFirebase,
} from "@datagee/elements"

const cloud = DGFirebase(firebaseConfig)

const YourComponent = () => {
    const [user, setUser] = useState(null)

    const signInAndDoStuff = async () => {
        const resp = await cloud.anonymousSignIn()
        const userData = await cloud.read(
            "YourCollection",
            resp?.user?.uid,
        )
        
        console.log(userData)
    }

    useEffect(
        () => {
            signInAndDoStuff()
        }, [user]
    )

    return (
        <>
            {/* Your component */}
        </>
    )
}

Support for AWS Amplify and offline caching for Firebase coming soon!

Documentation

For more information on this library, please see the documentation.

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago