0.2.0 • Published 3 years ago
loyality_typescript_lib_test_package v0.2.0
loyality_typescript_lib_test_package
This repo is the example of the article How to create and publish React Typescript npm package with demo and automated build
You can clone it and step by step create your own NPM package and publish it.
It is simple React counter.
Installation:
npm install loyality_typescript_lib_test_package --save-devor
yarn add -D loyality_typescript_lib_test_packageUsage :
Add MyCounter to your component:
Add AllArticle to your component:
Add Article to your component:
Add AllRewards to your component:
Add Reward to your component:
Add LoyalityCart to your component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { MyCounter } from 'loyality_typescript_lib_test_package'
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<div>
<h2>Default counter</h2>
<MyCounter />
</div>
<hr />
<div>
<h2>Counter with predefined value</h2>
<MyCounter value={5} />
</div>
<hr />
<div>
<h2>Article list</h2>
<AllArticle />
</div>
<hr />
<div>
<h2>Article Details</h2>
<Article />
</div>
<hr />
<div>
<h2>All Rewards</h2>
<AllRewards />
</div>
<hr />
<div>
<h2>Reward Details</h2>
<Reward />
</div>
<hr />
<div>
<h2>Cart</h2>
<LoyalityCart />
</div>
</React.StrictMode>,
)