@tasit/hooks
v0.0.33
Published
This package assumes you have React as a peer dependency so that you can use these hooks. For example, `@tasit/hooks` includes the functionality of `@tasit/account` for generating accounts but in the form of a hook you can use directly in a React componen
Downloads
6
Readme
@tasit/hooks
This package assumes you have React as a peer dependency so that you can use these hooks. For example, @tasit/hooks
includes the functionality of @tasit/account
for generating accounts but in the form of a hook you can use directly in a React component.
Commands
TSDX scaffolds your new library inside /src
.
The recommended workflow is to run TSDX in one terminal:
npm start
This builds to /dist
and runs the project in watch mode so any edits you save inside src
causes a rebuild to /dist
.
To do a one-off build, use npm run build
.
To run tests, use npm test
.
Configuration
Code quality is set up with prettier
, husky
, and lint-staged
.
Jest
Jest tests are set up to run with npm test
. This runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.
Folder Structure
/src
index.tsx
index.test.tsx
.gitignore
package.json
README.md
tsconfig.json
Bundler
The packages uses TSDX which uses Rollup v1.x as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
Optimizations
Please see the main tsdx
optimizations docs. In particular, know that you can take advantage of development-only optimizations:
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}
You can also choose to install and use invariant and warning functions.
Module Formats
CJS, ESModules, and UMD module formats are supported.
The appropriate paths are configured in package.json
and dist/index.js
accordingly. Please report if any issues are found.
Named Exports
Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.
Publishing to NPM
We recommend using np.