Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sayari/falcor-connect

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sayari/falcor-connect

react-falcor bindings

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-45.45%
Maintainers
4
Weekly downloads
 
Created
Source

Falcor Connect

React-Falcor bindings and a Higher Order Component

Usage

See /examples.

import { createElement } from 'react';
import { Model } from 'falcor'
import { createEventHandler, compose, withProps } from 'recompose'
import { Observable } from 'rxjs'
import { ChildProps, FalcorList, WithFalcor } from '../src'


const {
  stream: graphChange$,
  handler: graphChange,
} = createEventHandler<void, Observable<void>>()

const model = new Model({
  cache: {},
  onChange: graphChange as () => void,
})
  .batch()
  .boxValues()
  .treatErrorsAsValues()


const withFalcor = WithFalcor(model, graphChange$)

type Fragment = {
  todos: FalcorList<{ label: string, status: 'pending' | 'complete' }>
}

export const TodoList = compose(
  withProps({ page: 0 }),
  withFalcor<{ page: number }, Fragment>(({ page }) => [
    ['todos', { from: page, to: page + 10 }, ['label', 'status']],
    ['todos', 'length']
  ]),
  ({ page, graph: { todos }}: ChildProps<{ page: number }, Fragment>) => {
    return createElement('div', {},
      createElement('ul', {},
        Object.keys(todos)
          .filter((key) => key !== 'length')
          .map((key) => (
            createElement('li', {
              className: todos[key].status,
              key: todos[key].label
            }, todos[key].label)
          ))),
      createElement('p', {}, `Showing ${page * 10} to ${page * 10 + 10} of ${todos.length}`)
    )
  }
)

FAQs

Package last updated on 07 Sep 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc