Socket
Socket
Sign inDemoInstall

flamelink-react-hooks

Package Overview
Dependencies
38
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    flamelink-react-hooks

Some Flamelink SDK functionality exposed as React Hooks


Version published
Maintainers
1
Install size
20.6 kB
Created

Readme

Source

Some Flamelink SDK functionality exposed as React Hooks

Installation

npm install -S flamelink-react-hooks

Usage

flamelink-react-hooks uses the Flamelink SDK internally, so please take a look at the Installation & Usage sections for the SDK to see how you can instantiate the flamelinkApp instance.

import { createFlamelinkHooks } from 'flamelink-react-hooks'
import flamelink from 'flamelink/app'
import 'flamelink/content'
import 'flamelink/storage'

const flamelinkApp = flamelink(/* init flamelink app */)

const { useContent, useContentOnce } = createFlamelinkHooks({ flamelinkApp })

const YourComponent = function(props) {
  const [error, content] = useContent({ schemaKey: 'homepage' })

  if (error) {
    return <p>Error Error Error</p>
  }

  return (
    <section>
      <h1>{content.title}</h1>
      <p>{content.body}</p>
    </section>
  )
}

Available Hooks

The following hooks are currently available

useContent

This hook sets up a real-time subscription for the content you want.

returns: [error, content] Array with the first item an error object, otherwise it will be null and the second item will be the content payload - initially it will be null

useContentOnce

This hook queries once for the content you want without setting up a real-time connection.

returns: [error, content] Same as useContent

useNav

This hook sets up a real-time subscription for the navigation you want.

returns: [error, navigation] Array with the first item an error object, otherwise it will be null and the second item will be the navigation payload - initially it will be null

useNavOnce

This hook queries once for the navigation you want without setting up a real-time connection.

returns: [error, navigation] Same as useNav

useUsers

This hook sets up a real-time subscription for the users you want.

returns: [error, users] Array with the first item an error object, otherwise it will be null and the second item will be the users payload - initially it will be null

useUsersOnce

This hook queries once for the users you want without setting up a real-time connection.

returns: [error, users] Same as useUsers

History

Discover the release history by heading on over to the releases page.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Contributors

These amazing people have contributed code to this project:

License

Unless stated otherwise all works are:

and licensed under:

FAQs

Last updated on 14 Jan 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc