npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tushar-try

v0.2.0

Published

Basic Form React Component

Downloads

20

Readme

Publish React components as an npm package

Created the boilerplate with npx create-react-app

Procedure

  • Delete everything besides App.js and index.js
  • Create a folder lib inside src that stores everything I am to publish on npm.
    • Create components folder inside lib where component elements resides and index.js to export them

My Component MyForm

const MyForm = () => {
  return (
    <form>
      <h1>Hello</h1>
      <p>Enter your name:</p>
      <input type="text" />
    </form>
  );
};

Install Babel and build the dist folder

  • To install Babel, run the following in the CLI:
npm install --save-dev @babel/core @babel/cli @babel/preset-env
npm install -save @babel/polyfill

In the top-level folder of your project, add a file called babel.config.json and add the following presets:

{
 "presets": [
  [
   "@babel/env",
    {
     "targets": {
     "edge": "17",
     "firefox": "60",
     "chrome": "67",
     "safari": "11.1"
      },
   "useBuiltIns": "usage",
   "corejs": "3.6.5"
    }
],
   "@babel/preset-react"
]
}

@babel/env tells the browser which versions it should target, and @babel/preset-react allows Babel to compile JSX.

In package.json , under scripts, replace the build script with the following: "build": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files"

Alter the package.json

  "name": "tushar-try",
  "description": "Basic Form React Component",
  "author": "Tushar Goyal",
  "version": "0.1.0",
  "private": false,
  "main": "dist/index.js",
  "module": "dist/index.js",
  "files": [
    "dist",
    "README.md"
  ],
  "repository": {
    "type": "git"
  },

Now do npm login and then do npm publish

  • Now by including tushar-try library in any project , you can use the components that are exported in src/lib/index.js

This project was bootstrapped with Create React App.

Do npm install tushar-try in any project and You can use MyForm component from tushar-try package using import {MyForm} from tushar-try

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.