
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
inferno-firebase
Advanced tools
Inferno bindings for Firebase.
npm install --save inferno-firebase
Inferno Firebase requires Inferno 3.1.2 and Firebase 3 or later.
import Inferno from 'inferno'
import firebase from 'firebase'
import { connect } from 'inferno-firebase'
firebase.initializeApp({
databaseURL: 'https://inferno-firebase-sandbox.firebaseio.com'
})
const Counter = ({ value, setValue }) => (
<div>
<button onClick={() => setValue(value - 1)}>-</button>
<span>{value}</span>
<button onClick={() => setValue(value + 1)}>+</button>
</div>
)
export default connect((props, ref) => ({
value: 'counterValue',
setValue: value => ref('counterValue').set(value)
}))(Counter)
connect([mapFirebaseToProps], [mergeProps])
Connects a Inferno component to a Firebase App reference.
It does not modify the component class passed to it. Instead, it returns a new, connected component class, for you to use.
[mapFirebaseToProps(props, ref, firebaseApp): subscriptions
] (Object or Function): Its result, or the argument itself must be a plain object. Each value must either be a path to a location in your database, a query object or a function. If you omit it, the default implementation just passes firebaseApp
as a prop to your component.
[mergeProps(ownProps, firebaseProps): props
] (Function): If specified, it is passed the parent props
and current subscription state merged with the result of mapFirebaseToProps()
. The plain object you return from it will be passed as props to the wrapped component. If you omit it, Object.assign({}, ownProps, firebaseProps)
is used by default.
A Inferno component class that passes subscriptions and actions as props to your component according to the specified options.
Note: "actions" are any function values returned by
mapFirebaseToProps()
which are typically used to modify data in Firebase.
WrappedComponent
(Component): The original component class passed to connect()
.todos
as a propNote: The value of
todos
is the path to your data in Firebase. This is equivalent tofirebase.database().ref('todo')
.
const mapFirebaseToProps = {
todos: 'todos'
}
export default connect(mapFirebaseToProps)(TodoApp)
todos
and a function that adds a new todo (addTodo
) as propsconst mapFirebaseToProps = (props, ref) => ({
todos: 'todos',
addTodo: todo => ref('todos').push(todo)
})
export default connect(mapFirebaseToProps)(TodoApp)
todos
, completedTodos
, a function that completes a todo (completeTodo
) and one that logs in as propsconst mapFirebaseToProps = (props, ref, { auth }) => ({
todos: 'todos',
completedTodos: {
path: 'todos',
orderByChild: 'completed',
equalTo: true
},
completeTodo = id => ref(`todos/${id}/completed`).set(true),
login: (email, password) => auth().signInWithEmailAndPassword(email, password)
})
export default connect(mapFirebaseToProps)(TodoApp)
<Provider firebaseApp>
By default connect()
will use the default Firebase App. If you have multiple Firebase App references in your application you may use this to specify the Firebase App reference available to connect()
calls in the component hierarchy below.
If you really need to, you can manually pass firebaseApp
as a prop to every connect()
ed component, but we only recommend to do this for stubbing firebaseApp
in unit tests, or in non-fully-Inferno codebases. Normally, you should just use <Provider>
.
firebaseApp
(App): A Firebase App reference.children
(InfernoElement): The root of your component hierarchy.import { Provider } from 'inferno-firebase'
import { initializeApp } from 'firebase'
const firebaseApp = initializeApp({
databaseURL: 'https://my-firebase.firebaseio.com'
})
Inferno.render(
<Provider firebaseApp={firebaseApp}>
<MyRootComponent />
</Provider>,
rootEl
)
MIT © 2016 Magnus Bergman hello@magnus.sexy (https://magnus.sexy/)
react-firebase
which this library is a port of.
FAQs
Inferno bindings for Firebase
The npm package inferno-firebase receives a total of 0 weekly downloads. As such, inferno-firebase popularity was classified as not popular.
We found that inferno-firebase 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.