
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
react-firestore-connect
Advanced tools
HOC for React components which maps collections / documents from firestore into react components as props.
Higher order component for React components which provides them with data from collections / documents. Super easy to use. Both for React & React Native!
Via yarn
yarn add react-firestore-connect
or NPM
npm install --save react-firestore-connect
First you need to initialize react-firestore-connect with Firebase in the root JS file of your app (typically index.js
):
import firebase from 'firebase' // If you are developing for web
// import firebase from 'react-native-firebase' - if you are developing for mobile (React Native)
import { initializeFirebase } from 'react-firestore-connect'
initializeFirebase(firebase)
Afterwards, you can easily use it:
import { connectFirestore } from 'react-firestore-connect'
class Example extends Component {
render () {
const {
users,
currentUser,
} = this.props
console.log('Users in the application', users)
console.log('Currently logged in user', currentUser)
return <div />
}
}
export default connectFirestore(
// db is reference to firestore DB;
// props are any props that you are passing to the component - i.e. userId to get specific user
// uid - userId, if user is authenticated in firebase -> firebase.auth().currentUser.uid
(db, props, uid) => ({
users: db.collection('names'), // You can get entire collection
threeUsersOrdered: db.collection('names').orderBy('firstName').limit(3), // You can also do any querying as you want
currentUser: db.collection('names').doc(uid), // You can obviously get any document by its ID
usersArray: [db.collection('names').doc(props.id[0]), db.collection('names').doc(props.id[1]), db.collection('names').doc(props.id[2])], // You can also send array of doc referencies
}),
Example,
)
See example folder for more details & api call examples!
FAQs
HOC for React components which maps collections / documents from firestore into react components as props.
The npm package react-firestore-connect receives a total of 32 weekly downloads. As such, react-firestore-connect popularity was classified as not popular.
We found that react-firestore-connect 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
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.