1.0.0 • Published 3 years ago

@usable-react/use-interval v1.0.0

Weekly downloads
136
License
MIT
Repository
github
Last release
3 years ago

⚓️ usable-react

code style: airbnb code style: prettier

Basic React hooks to get any project off the ground.

🔗 Installation

Install via yarn:

yarn add usable-react

# or, install hooks individually:
yarn add @usable-react/use-compare
yarn add @usable-react/use-debounced
# ...and so on :)

Install via npm:

npm install usable-react

# or, install hooks individually:
npm install @usable-react/use-dom-event
npm install @usable-react/use-force-update
# ...and so on :)

Hooks

usable-react is managed as a monorepo so that hooks can be used collectively, or optimized as separate dependencies.

Package NameDescription
usable-reactA package containing all the hooks!
@usable-react/use-compareCheck if a value has changed since the last render.
@usable-react/use-debouncedDebounce an incoming change to the given value.
@usable-react/use-deferred-childrenGet a copy of the given React children, deferred to the next update.
@usable-react/use-dom-eventCreate event listeners outside the React lifecycle for a given DOM element.
@usable-react/use-effect-after-mountJust like useEffect, but only executes after mounting!
@usable-react/use-effect-triggerAn effect you can trigger with a function call!
@usable-react/use-filterPerform a fuzzy search on a dataset using fuse.js.
@usable-react/use-force-updateForce a component to re-render.
@usable-react/use-hashGet the MD5 hash of an arbitrary object (based on object-hash).
@usable-react/use-hash-compareJust like useCompare, but using the value's MD5 hash.
@usable-react/use-initial-renderJust like useEffect, but only executes on a component's initial render.
@usable-react/use-intervalExecute an effect on an interval (with automatic cleanup).
@usable-react/use-previousReturns the previous value of the given source.
@usable-react/use-timerContains several hooks to easily create timers within the React lifecycle.

Contributing

usable-react is at an early stage of development, so contributing is a great way to both move the project forward and have your ideas represented! Here are some steps to open a PR:

  1. Fork it!
  2. Create a branch based off development named with a package directory (or directories), leading label, and a descriptive title:
    • {package}/{label}/{descriptive title}
    • For features: usable-react/feature/my-brand-spankin-new-thing or use-hash/feature/my-brand-spankin-new-thing
    • For bug fixes: usable-react/fix/my-bug-fix or something like use-timer/fix/my-bug-fix
  3. Set up your local development environment:
    1. yarn install
    2. yarn bootstrap
    3. PKG=$PACKAGE_TARGET yarn dev
  4. Make your changes! Commit early and often and write good commit messages.
  5. Open a draft PR so that a core contributor (probably @smithki) can review the code and merge your changes!

As aforementioned, this project is still taking shape :baby: More formal contributor processes will undoubtedly be added over time according to the project's needs!

Development Scripts

NPM ScriptUsageDescription
bootstrapyarn bootstrapInstall dependencies/set up a local development environment.
execPKG=$PACKAGE_TARGET yarn exec -- ...Execute commands in the specified package.
devPKG=$PACKAGE_TARGET yarn devStart the specified package in development mode, or all packages if $PKG is omitted.
buildPKG=$PACKAGE_TARGET yarn buildBuild the specified package for production, or all packages if $PKG is omitted.
cleanPKG=$PACKAGE_TARGET yarn cleanRun cleaning scripts for the specified package, or all packages if $PKG is omitted.
lintPKG=$PACKAGE_TARGET yarn lintRun the linter for the specified package, or all packages if $PKG is omitted.
testPKG=$PACKAGE_TARGET yarn testRun tests for the specified package, or all packages if $PKG is omitted.
releaseyarn releasePublishes all packages with unreleased versions.
release_canaryyarn release_canaryPublishes pre-release versions for all packages.
1.0.0

3 years ago

0.9.0

3 years ago

0.8.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago