# @datagee/elements

> React and React Native database implementations and utilities.

Latest version **1.0.8** (published 2023-07-16) · 0 weekly downloads

## Install

```sh
npm install @datagee/elements
pnpm add @datagee/elements
yarn add @datagee/elements
bun add @datagee/elements
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2023-07-16 |
| First published | 2023-05-14 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 109 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Datagee |
| Maintainers | meatberger |
| Keywords | firebase, amplify, react-native, react-native-web |

## Links

- npm: https://www.npmjs.com/package/@datagee/elements
- Repository: https://github.com/Datagee/elements
- Homepage: https://github.com/Datagee/elements#readme
- Issues: https://github.com/Datagee/elements/issues
- npm.io page: https://npm.io/package/@datagee/elements

## Dependencies (6)

- [react](https://npm.io/package/react.md) ^18.2.0
- [firebase](https://npm.io/package/firebase.md) ^9.22.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [react-native](https://npm.io/package/react-native.md) 0.71.7
- [react-native-uuid](https://npm.io/package/react-native-uuid.md) ^2.0.1
- [@react-native-async-storage/async-storage](https://npm.io/package/@react-native-async-storage/async-storage.md) 1.17.11

## Recent versions

- 1.0.8 (latest) — 2023-07-16
- 1.0.7 — 2023-07-16
- 1.0.6 — 2023-05-15
- 1.0.5 — 2023-05-15
- 1.0.4 — 2023-05-15
- 1.0.3 — 2023-05-15
- 1.0.2 — 2023-05-15
- 1.0.1 — 2023-05-15
- 1.0.0 — 2023-05-14

## README

<div style="display:inline;">
    <div>
        <img src="https://datagee.com/static/media/dgClear.138ed66b78c9f32f7cf14d30a628532b.svg" height=64 width=64 />
    </div>
</div>

## Elements by Datagee (Beta)
#### Software engineering elements for forward-thinking developers.
<br />

## 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:

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

Easily add cloud services to your project like this:

```typescript
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](https://elements.datagee.com).

---
_Source: https://npm.io/package/@datagee/elements · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
