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

@filecoin-shipyard/use-filecoin-config

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@filecoin-shipyard/use-filecoin-config

React hook to load config via Filecoin API

  • 0.0.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
8
Weekly downloads
 
Created
Source

@filecoin-shipyard/use-filecoin-config

React hook to load config via Filecoin API

Uses js-filecoin-api-client to connect to the go-filecoin HTTP API running on localhost.

Note: Even though it is a React hook, it was built to be used in command-line apps that run in a Node.js environment, it has not yet been used in the browser.

Example

From filecoin-big-head which uses React with Ink in a Node.js interactive command-line app:

import useFilecoinConfig from '@filecoin-shipyard/use-filecoin-config'

const Main = () => {
  const [nickError, nickname] = useFilecoinConfig('heartbeat.nickname')

  return <Box>{nickname && nickname}</Box>
}

API

useFilecoinConfig(key, [options])

Parameters
NameTypeDescription
keyStringDot separated key to config value to retrieve
optionsObjectOptional options
options.intervalNumberRequery the config value every interval milliseconds (Default: 1000)
Returns

Returns an array of values, like other React hooks.

IndexTypeDescription
0ErrorError object or null
1?Value from config

License

MIT/Apache-2 (Permissive License Stack)

FAQs

Package last updated on 28 Sep 2019

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