Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
firebase-react
Advanced tools
Readme
Connect firebase queries to react props. Supports lists of queries grouped into a single prop, allowing you to easily circumvent some Firebase query limitations.
Uses a simple HOC API inspired by react-redux.
npm i -S firebase-react
Alternatively:
<script src="https://unpkg.com/firebase-react/dist/firebase-react.min.js"></script>
(exposes window.FirebaseReact as a global variable)
Basic usage example below (better docs and examples coming soon):
// Dinosaurs.js
import React from 'react'
import { firebaseConnect } from 'firebase-react'
const Dinosaurs = ({ shortDinosaurs, tallDinosaurs, shortAndTallDinosaurs }) => {
return (
<div>
<h1>Short Dinosaurs:</h1>
<ul>
{shortDinosaurs.map(dino => (
<li>{dino.name}: {dino.height}</li>
))}
</ul>
<h1>Tall Dinosaurs:</h1>
<ul>
{tallDinosaurs.map(dino => (
<li>{dino.name}: {dino.height}</li>
))}
</ul>
<h1>Short and Tall Dinosaurs:</h1>
<ul>
{shortAndTallDinosaurs.map(dino => (
<li>{dino.name}: {dino.height}</li>
))}
</ul>
</div>
)
}
export default firebaseConnect((db, props) => ({
// dinos less than 5m tall
shortDinosaurs: db.ref('dinosaurs').orderByChild('height').endAt(5),
// dinos greater than 25m tall
tallDinosaurs: db.ref('dinosaurs').orderByChild('height').startAt(25),
// dinos either shorter than 5m or taller than 25m
shortAndTallDinosaurs: [
db.ref('dinosaurs').orderByChild('height').endAt(5),
db.ref('dinosaurs').orderByChild('height').startAt(25),
],
}))(Dinosaurs)
// index.js
import React from 'react'
import ReactDOM from 'react-dom'
import * as firebase from 'firebase'
import { FirebaseProvider } from 'firebase-react'
import Dinosaurs from './Dinosaurs'
const config = {
apiKey: "<Your Firebase API Key",
authDomain: "<Your Firebase Auth Domain>",
databaseURL: "<Your Firebase Database URL>",
messagingSenderId: "<Your Messaging Sender ID>"
}
firebase.initializeApp(config)
ReactDOM.render(
<FirebaseProvider firebase={firebase}>
<Dinosaurs />
</FirebaseProvider>,
document.getElementById('app')
)
FAQs
Connect firebase queries to react props with a simple HOC API
The npm package firebase-react receives a total of 2 weekly downloads. As such, firebase-react popularity was classified as not popular.
We found that firebase-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.