npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rndm/render-preset-firedux

v0.2.3

Published

RNDM Render Preset: Firedux. Firebase and Redux functionality for RNDM Render

Downloads

5

Readme

RNDM Render Preset: Firedux

About

This preset provides functionality for RNDM Render package for combined integrations of Firebase and Redux (Firedux!).

It includes the following packages:

Installation

If you have not already done so, then please ensure you have installed the RNDM Render package.

RNDM Render Preset: Firedux

About

This preset provides functionality for RNDM Render package for combined integrations of Firebase and Redux (Firedux!).

It includes the following packages:

Installation

If you have not already done so, then please ensure you have installed the RNDM Render package.

65f3fb9886e3f3abd255e7543917a367538769c5

From NPM

npm install --save @rndm/render-preset-firedux

Post Installation

In order to allow this plugin to work, it must first be included in your project. You can do this inside your main index file:

import '@rndm/render-preset-firedux';

Usage

Components

Firebase.Dispatcher.Redux

The Firedux Plugin contains one additional Component that solves the integration of Firebase with a state based Redux approach (i.e. the views are maintained in the Redux state and changes are propagated to the listening Components)

Within this component, you are able to access your Firebase data either through the Database or Firestore. Each of these paradigms gives you different pros and cons, and we would whole-heartedly recommend you review the options within the Firebase architecture to determine your preferred mechganism for persisting your data.

With Database

The Database option is the original JSON bases database system created with Firebase. It is extremely responsive and greate for persisitng simplistic JSON objects, such as light-weight views or small amounts of data. When used, it should be noted that there is a limit of 32 leves of depth, so complext or deep view structures can be rejected at the time of trying to persist. In a number of ways, the RNDM Builder plugin assists in reducing the overhead of this. However, if you require your API to go beyopnd this depth, then you will need to review the Firestore option.

Example

{
  "type": "Firebase.Wrapper.Config",
  "props": {
    "config": {
      "databaseURL": "https://rndm-com.firebaseio.com"
    },
    "children": {
      "type": "Firebase.Dispatcher.Redux",
      "props": {
        "reference": "example",
        "path": "test.view",
        "children": {
          "type": "RNDM.Renderer",
          "props": {
            "middleware": [
              {
                "middleware": "redux.connect",
                "args": [
                  [
                    {
                      "from": "rndm.test.view",
                      "to": "layout",
                      "default": {
                        "type": "RNDM.Empty"
                      }
                    }
                  ]
                ]
              }
            ]
          }
        }
      }
    }
  }
}
With Firestore

Firestore is the modern update to the Firebase data persistence tooling. It is a real-time, queryable NoSQL database which can contain documents of up to 1MB in size. This option allows for a greater amount of flexibility with your approach to the persistance model opf your real-time application

There are two different options with regards to the Firestore:

observe: This is a boolean value that allows you to determine whether you wish the element to observe for changes in the data, or to fetch for one time only.

queries: This is an array of queries that can be passed into your element to allow for multiple documents being determined. For full documetnation around these, we recommeend reading through the Firebase documentation around querying.

Example

{
  "type": "Firebase.Wrapper.Config",
  "props": {
    "config": {
      "databaseURL": "https://rndm-com.firebaseio.com"
    },
    "children": {
      "type": "Firebase.Dispatcher.Redux",
      "props": {
        "observer": "firestore",
        "reference": "collection/document",
        "path": "test.view",
        "observe": true,
        "children": {
          "type": "RNDM.Renderer",
          "props": {
            "middleware": [
              {
                "middleware": "redux.connect",
                "args": [
                  [
                    {
                      "from": "rndm.test.view",
                      "to": "layout",
                      "default": {
                         "type": "RNDM.Empty"
                       }
                    }
                  ]
                ]
              }
            ]
          }
        }
      }
    }
  }
}

The above example will fetch the document called 'document' from a collection called 'collection', and observe it for any changes.

Example 2

{
  "type": "Firebase.Wrapper.Config",
  "props": {
    "config": {
      "databaseURL": "https://rndm-com.firebaseio.com"
    },
    "children": {
      "type": "Firebase.Dispatcher.Redux",
      "props": {
        "observer": "firestore",
        "reference": "collection0/document/collection1",
        "path": "test.view",
        "queries": [
          [
            "type",
            "==",
            "react-native.View"
          ]
        ],
        "children": {
          "type": "RNDM.Renderer",
          "props": {
            "middleware": [
              {
                "middleware": "redux.connect",
                "args": [
                  [
                    {
                      "from": "rndm.test.view",
                      "to": "layout",
                      "default": {
                         "type": "RNDM.Empty"
                       }
                    }
                  ]
                ]
              }
            ]
          }
        }
      }
    }
  }
}

The above example will look under the collection1 which is a collection within the document under collection0 and query it to find any documents where the type of the first element is equal to 'react-native.View'.

Firestore Component

The Firestore Component allows your application to directly access the Firestore without serialisation.

Example

import React from 'react';
import { View } from 'react-native';
import firebase from 'firebase';
import { Firestore } from '@rndm/render-preset-firedux';

const app = firebase.initializeApp({ databaseURL: 'https://rndm-com.firebaseio.com' }, 'myApp');

const MyView = () => (
    <View
        style={{
            padding: 10,
        }}
    >
        <Firestore app={app} path='collection.document' onResponse={() => console.log('Success')} />
    </View>
);

export default MyView;

Firebase Base Extension

The Firebase Component extends the Base Component from the firebase plugin. It has been written to work the setup of of an initialised Firebase application, and handles the updates of any RNDM JSON passed from the Firebase Database.

Example

import React from 'react';
import { View } from 'react-native';
import firebase from 'firebase';
import { Firebase } from '@rndm/render-preset-firedux';

const app = firebase.initializeApp({ databaseURL: 'https://rndm-com.firebaseio.com' }, 'myApp');

const MyView = () => (
    <View
        style={{
            padding: 10,
        }}
    >
        <Firebase app={app} path='example' onResponse={() => console.log('Success')} />
    </View>
);

export default MyView;

Examples

Full examples can be found in the example library found in this project.

https://github.com/rndm-com/rndm-render-preset-firedux/tree/master/examples

Check out the Playground page to see how these features work.