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

react-to-component

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-to-component

Blazing fast library to componentify imperative or functional apis

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

react-to-component

Travis npm package Coveralls semantic-release

:rocket: Blazing fast and tiny library that enables you to create react components (componentify) imperative or functional apis.

Install

yarn add react-to-component

Aims to be:

  • :rocket: Blazing fast
  • ➿Defensive code friendly
  • :rage2: Async first
  • 🔧 Memory leak safe
  • :ring: Test friendly

A quick example

<ToComponent original={oldLegacyCodeApi} params={[1, 2, 3]}>
  {({ loading, error, data }) =>
    loading ? "Loading" : error ? "Oops, error" : JSON.stringify(data)
  }
</ToComponent>

Live examples

  • Async example
    Edit react-to-component async example

Configuration

PropRequiredDefaultTypeDescription
original✔️✖️(...params: P[]) => Promise<T> or TThe original function to be encapsulated
params✔️✖️P[]The params that will be used in the function invocation
children✔️✖️({ data: T or null, error: Error or null, loading: boolean }) => JSX.Element or JSX.Element[] or nullThe render prop that controls you data flow
parametersDidChange✖️Params equality(previousParams: P[], nextParams: P[]) => booleanAbility to supply a custom check for parameter equality, use this if for example you need to ignore some parameters for caching purposes

Keywords

FAQs

Package last updated on 10 Oct 2018

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