Innocuous > Components
A set of harmless React components.
This component library was bootstrapped using tsdx.
Installation
yarn add @innocuous/components
Commands
The recommended workflow is to run TSDX in one terminal:
yarn start
This builds to /dist
and runs the project in watch mode so any edits you save inside src
causes a rebuild to /dist
.
Then run the example inside another:
cd example
yarn # install dependencies
yarn start
The default example imports and live reloads whatever is in /dist
, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. No symlinking required, we use Parcel's aliasing.
To do a one-off build, use yarn build
.
To run tests, use yarn test
.
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');
}
Using the Playground
cd example
yarn # install dependencies
yarn start
The default example imports and live reloads whatever is in /dist
, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. No symlinking required!
Named Exports
Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.