@fstn/react-library
v1.0.842
Published
@fstn/react-library.
Downloads
133
Readme
Example typescript react component library
An example project setup that allows for publishing a TypeScript React component module to npm.
Initially setup using create-react-library and converted to use TypeScript
.
Project structure
The project contains a src
directory containing the module files that get published to npm, and an example
directory containing a working create-react-app
project that contains an example usage of the module.
CI
This example also includes a .gitlab-ci.yml
which publishes the module to npm
(based on this guide) and deploys an example build to GitLab pages.
Development
Setup
Module
Whilst in the root directory, install dependencies
npm install
To run in watch mode
npm start
To build
npm run build
Example create-react-app
First, cd into the example directory
cd example
Install dependencies
npm install
To run development server
npm start
To build
npm run build
Contributing
Please read CONTRIBUTING.md.
Deployed Module
Install
npm install --save example-typescript-react-component-library
Usage
import * as React from "react";
import MyComponent from "example-typescript-react-component-library";
class Example extends React.Component {
render() {
return <MyComponent />;
}
}