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

@washingtonpost/red-react-lib

Package Overview
Dependencies
Maintainers
108
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@washingtonpost/red-react-lib

This lib points to be a shared codebase for the different projects inside the WP.

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-70%
Maintainers
108
Weekly downloads
 
Created
Source

red-react-lib

This lib points to be a shared codebase for the different projects inside the WP.

For the time being we are using it as a git subtree

Updating this lib

In order to update/commit an update, the code needs to be built before pushing. Please just edit the src folder contents The components folder will be generated by the build script.

To build the project just run

yarn install
yarn build

hooks

hooks.usePromiseCallback(promise, deps, delayMS)

usePromiseCallback Hook

Hook dedicated to offer a sync way of accessing a promise state.

Keeps the last result until new results are loaded, to avoid UI flashes.

Supports a delayMS param to customise the loading threshold, to avoid UI flashes.

Only processes the last promise call.

Kind: static method of hooks

ParamTypeDescription
promisePromiseThe promise that would be wrapped
depsArray.<any>extra deps used to re-create the callback
delayMSnumberThe delay in ms to switch the loading state to true

Example

const [callback, result, loading, err] = usePromiseCallback(Promise.resolve, [], 500)

hooks.usePromise(promise, deps, delayMS)

usePromise Hook

Wrapped usePromiseCallback.

It gets triggered on init and every time the args change by default.

Useful to fetch page data.

Kind: static method of hooks

ParamTypeDescription
promisePromiseThe promise that would be wrapped
depsArray.<any>deps to call the function with
delayMSnumberThe delay in ms to switch the loading state to true

Example

const [callback, result, loading, err] = usePromise(Promise.resolve, ["hello"], 500)

hooks.usePrevious(value)

usePrevious Hook

Got from https://usehooks.com/usePrevious/ It saves the previous value of props or state

Kind: static method of hooks

ParamTypeDescription
value*The value to save

Example

const [state, setState] = React.useState()
const prev = usePrevious(state)

FAQs

Package last updated on 22 Jul 2020

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